(defun c:fs_xhq	(/ *sc*	att blk	def ins	k la line pt1 pt2 sc sp	USKEY
		 DRAG *ERROR* MSG)
  (setq pt1 (getpoint "\n指定第一点："))
  (cond	((null $fs_xhq$)
	 (setq $fs_xhq$ "1")
	)
	((numberp (read $fs_xhq$))
	 (setq $fs_xhq$ (itoa (1+ (atoi $fs_xhq$))))
	)
  )
  (setq *sc* (* (getvar "dimtxt") (getvar "dimscale") 0.4))
  (defun msg ()
    (princ
      "\n指定第二点[序号+1(+)/序号-1(-)/字高(H)/设置序号(任意)退出(右键)]:"
    )
  )
  (msg)
  (or pt1 (fsxm-silenceexit))
  (cond	((tblsearch "BLOCK" "FSXM_序号球"))
	(t
	 (entmake
	   '((0 . "BLOCK") (2 . "FSXM_序号球") (70 . 2) (10 0 0 0))
	 )
	 (entmake
	   '((0 . "CIRCLE") (10 0.0 0.0 0.0) (8 . "0") (40 . 2.625))
	 )
	 (entmake (list	'(0 . "ATTDEF")
			'(410 . "Model")
			'(8 . "0")
			'(10 0 0 0)
			'(40 . 2.5)
			'(1 . "1")
			'(50 . 0.0)
			'(51 . 0.0)
			(cons 7 (getvar "dimtxsty"))
			'(71 . 0)
			'(72 . 4)
			'(11 0 0 0)
			'(3 . "序号：")
			'(2 . "序号")
			'(70 . 0)
			'(73 . 0)
			'(74 . 0)
		  )
	 )
	 (entmake '((0 . "ENDBLK")))
	)
  )
  (vla-StartUndoMark *doc*)
  (setq la (entlast))
  (defun *error* (msg)
    (foreach en (fsxm-newenlist la) (entdel en))
  )
  (setq pt1 (trans pt1 1 0))
  (entmakex
    (list '(0 . "LEADER")
	  '(100 . "AcDbEntity")
	  '(100 . "AcDbLeader")
	  '(72 . 0)
	  (cons 10 pt1)
	  (cons 10 (mapcar '+ pt1 '(1e-5 1e-5)))
    )
  )
  (setq line (vlax-ename->vla-object (entlast)))
  (vla-put-ScaleFactor line *sc*)
  (setq sc (* *sc* (/ 2.5 (getvar "dimtxt"))))
  (vla-put-ScaleFactor line sc)
  (setq sp (fsxm-activespace))
  (setq ins (vlax-3d-point pt1))
  (vla-InsertBlock sp ins "FSXM_序号球" *sc* *sc* *sc* 0)
  (setq blk (vlax-ename->vla-object (entlast)))
  (setq att (last (car (fsxm-refatt (entlast)))))
  (fsxm-setendxf att 1 $fs_xhq$)
  (fsxm-setendxf att 7 (getvar "dimtxsty"))
  (defun drag (pt)
    (setq pt (trans pt 1 0))
    (setq pt2 (polar pt (angle pt pt1) (* *sc* 2.625)))
    (vla-put-Coordinate line 1 (vlax-3d-point pt2))
    (vla-put-InsertionPoint blk (vlax-3d-point pt))
  )
  (defun uskey (key)
    (cond
      ((wcmatch key "#")
       (fsxm-setendxf att 1 key)
      )
      ((= (strcase key) "H")
       (setq def (fsxm-tostring (* 2.5 *sc*)))
       (setq sc (getdist (strcat "输入字高<" def ">：")))
       (cond (sc
	      (setvar "dimscale" (/ sc (getvar "dimtxt")))
	      (setq *sc* (* (getvar "dimtxt") (getvar "dimscale") 0.4))
	      (vla-put-XScaleFactor blk *sc*)
	      (vla-put-YScaleFactor blk *sc*)
	      (vla-put-ZScaleFactor blk *sc*)
	      (setq sc (* *sc* (/ 2.5 (getvar "dimtxt"))))
	      (vla-put-ScaleFactor line sc)
	     )
       )
      )
      ((= key "-")
       (setq k (fsxm-getendxf att 1))
       (setq k (itoa (1- (atoi k))))
       (fsxm-setendxf att 1 k)
      )
      ((vl-string-search key "+=")
       (setq k (fsxm-getendxf att 1))
       (setq k (itoa (1+ (atoi k))))
       (fsxm-setendxf att 1 k)
      )
      (t
       (setq k (getstring "请输入序号："))
       (fsxm-setendxf att 1 k)
      )
    )
    (setq $fs_xhq$ (fsxm-getendxf att 1))
    (msg)
  )
  (fsxm-drag '(setq mousemove '(drag dypoint)
		   keydown   '(uskey key)
		   curtype   1
		   other     '(exit)
	     )
  )
  (fsxm-add-group (list line blk) "*")
  (vla-EndUndoMark *doc*)
  (c:fs_xhq)
  (princ)
)