[求助]请教怎样把多段线只保留选择时选取的一段其余的删掉 。
请教怎样把多段线只保留选择时选取的一段其余的删掉 。<BR> (defun c:xysbl (/co getco i s s0 s1 ss ss1);;多选颜色保留
(defun GetCo (s0 / a co en la)
(setq en (entget s0))
(if(setq a (assoc 62 en))
(cdr a)
(cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 en)))))
)
)
(if (and (progn (princ "\n多选过滤颜色对象:")
(setq s0 (ssget ))
)
(setq s0 (mapcar 'GetCo (vl-remove-if 'listp (mapcar 'cadr (ssnamex s0)))))
(progn
(princ "\n选择目标对象:")
(setq s (ssget))
)
(setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
(setq s (mapcar '(lambda(x)(list x (GetCo x)))s))
(setq s (vl-remove-if-not '(lambda(x)(member (cadr x) s0))s))
(setq s (mapcar 'car s))
(setq ss (ssadd))
(progn (foreach x s (ssadd x ss)) t)
)
(progn
(sssetfirst nil ss)
(princ (strcat "\n已选择" (itoa (sslength ss)) "个对象"))
(command "erase" (ssget "a") "r" ss "")
(princ)
)
)
)
页:
[1]