你试下下面这段代码,
(defun c:te( / cpt ent i itm lst r ss tem)
(setq ss (ssget '((0 . "CIRCLE")))
tem '()
i 0
)
(repeat (sslength ss)
(setq ent (ssname ss i)
i (1+ i)
cpt (sam_dxf ent 10)
cpt(list (/ (fix(* 100000.0(car cpt)))100000.0)
(/ (fix(* 100000.0(cadr cpt)))100000.0)
(/ (fix(* 100000.0(caddr cpt)))100000.0)
)
r (sam_dxf ent 40)
lst (list(list r (sam_dxf ent 5)))
)
(setq itm (assoc cpt tem))
(if itm
(if (and (> i 1)(> r (caadr itm)))
(setq tem (vl-remove itm tem)
tem (append tem(list(append (list cpt) lst)))
)
)
(setq tem(append tem(list(append (list cpt) lst))))
)
)
(setq ss (ssadd))
(foreach x tem
(setq ss (ssadd (handent (last(last x)))ss))
)
(command "change" ss "" "p" "c" 1 "")
)
(defun sam_dxf (ent n)
(if (= (type ent) 'ename)
(cdr (assoc n (entget ent)))
)
)