这个要求太高了,
一个直线?
一个圆?
一个点?
一个块?
一个多线?
一个图层?
一个颜色?
一个文字?
要知道,要达到这些要求,以上每项都要一个代码,全部下来是很要时间的
(defun c:aq () ;同长、同图层曲线
(if (setq s1 (car (entsel "\n选择查找相同类型的圆,线,多段线的个数: ")))
(progn
(setq ll (getCurveLength s1)
la (xyp-DXF 8 s1)
i -1
qf (list '(0 . "*LINE,ARC,CIRCLE,ELLIPSE") (cons 8 la))
ss (ssget "x" qf)
ss1 (ssadd)
)
(while (setq s1 (ssname ss (setq i (1+ i))))
(if (equal (getCurveLength s1) ll 1e-3)(ssadd s1 ss1))
)
(sssetfirst nil ss1)
(princ (strcat "\n找到 " (itoa (sslength ss1)) " 个对象"))
)
)
(princ)
)
(defun GetCurveLength (curve / )
(setq curve (vlax-ename->vla-object curve))
(vlax-curve-getDistAtParam curve
(vlax-curve-getEndParam curve)
)
)
(defun xyp-DXF (code s1 / ent lst a)
(if (= (type code) 'LIST)
(progn
(setq ent (entget s1)
lst '()
)
(foreach a code
(setq lst (cons (list a (cdr (assoc a ent))) lst))
)
(reverse lst)
)
(if (= code -3)
(cdr (assoc code (entget s1 '("*"))))
(cdr (assoc code (entget s1)))
)
)
)
;-------------end
哇哇 50分
你还不如用快速选择