CAD AutoLisp 选取相同图层
选择一个图元选择相同图层
lisp
(defun c:tt()
(setq ss (ssget));选择对象
(setq i 0);变量初始化
(setq tc (cdr (assoc 8 (entget (ssname ss 0)))));提取图层名
(setq tc (strcat tc ","));在图层名后面添加逗号
(repeat (sslength ss);开始循环
(setq tu (cdr (assoc 8 (entget (ssname ss i)))));提取图层名
(setq tu (strcat tu ","));在图层名后面添加逗号
(setq tc (strcat tc tu));合并图层名
(setq i (1+ i));变量加1
)
(setq ss (ssget "X" (list (cons 8 tc))));选中图层内所有对象
(sssetfirst nil ss);将ss选择集高亮显示
(princ);防止回显
)