;;加中心线
(defun c:center_line	(/ ang1	ang2 cen date en la n name p1 p1_ p2 p2_ r r+x
		 r1+ r2+ sc ss x)
  (fsxm-maklayer "Center" 30 "Center2" nil)
  (while (progn	(princ "\n请选取欲加中心线的圆或弧:")
		(setq ss (ssget ":S" '((0 . "arc,circle,ellipse"))))
	 )
    (setq la '(8 . "center"))
    (setq r+x 1.2)
    (setq n -1)
    (repeat (sslength ss)
      (setq en	 (ssname ss (setq n (1+ n)))
	    date (entget en)
	    cen	 (fsxm-getdxf 10 date)
	    name (fsxm-getdxf 0 date)
      )
      (if (= name "ELLIPSE")
	(progn
	  (setq	x    (cdr (assoc 11 date))
		sc   (cdr (assoc 40 date))
		ang1 (angle '(0 0) x)
		r1+  (* (distance x '(0 0)) 1.2)
		r2+  (* r1+ sc)
	  )
	)
	(progn
	  (setq	ang1 0
		r    (cdr (assoc 40 date))
		r1+  (* r r+x)
		r2+  r1+
	  )
	)
      )
      (setq ang2 (+ ang1 (/ pi 2)))
      (setq p1 (polar cen ang1 r1+))
      (setq p1_ (polar cen ang1 (- r1+)))
      (setq p2 (polar cen ang2 r2+))
      (setq p2_ (polar cen ang2 (- r2+)))
      (setq line1
	     (entmakex
	       (list
		 '(0 . "line")
		 la
		 (cons 10 p1)
		 (cons 11 p1_)
	       )
	     )
      )
      (setq line2
	     (entmakex
	       (list
		 '(0 . "line")
		 la
		 (cons 10 p2)
		 (cons 11 p2_)
	       )
	     )
      )
      (fsxm-add-group
	(mapcar 'vlax-ename->vla-object (list line1 line2))
	"*"
      )
    )
  )
  (princ)
)
(princ)