wanhongron 发表于 2022-5-18 09:11:59

图层过滤改成手动灵活选择

图层过滤(setq        ss (ssget'(8 . "图层1、图层2、图层3")))能改成通过鼠标灵活选取对象获取图层吗?

start4444 发表于 2022-5-18 14:56:36

(defun c:tt5 (/ en i lystr ss1 ss2)
        (prompt "\n选择源对象<右键结束>:")
(setq ss1 (ssget) i 0 lystr (cdr (assoc 8 (entget (ssname ss1 0)))))
        (repeat (1- (sslength ss1))
                (setq en (ssname ss1 (setq i (1+ i))))
                (setq lystr (strcat lystr "," (cdr (assoc 8 (entget en)))))
        )
        (prompt "\n选择目标对象 或 [全选(右键)]:")
        (setq ss2 (ssget (list (cons 8 lystr))))(if (not ss2) (setq ss2 (ssget "x" (list (cons 8 lystr)))))
(sssetfirst nil ss2)
(princ)
)

恒毅 发表于 2022-5-18 09:43:23

(setq
        enlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex(ssget))))
        tcstr (cdr (assoc 8 (entget (car enlst) )))
        enlst (cdr enlst)
        nu (mapcar '(lambda(x) (setq tcstr (strcat tcstr "," (cdr (assoc 8 (entget x)))))) enlst)
        ss (ssget "x" (list (cons 8 tcstr)))
)

magicheno 发表于 2022-5-18 12:49:14

学习楼~~~~

xyp1964 发表于 2022-5-18 13:36:19


(defun c:tt ()
(setq la "")
(while (setq s1 (car (entsel "\n选择: ")))
    (setq la (strcat la "," (cdr (assoc 8 (entget s1)))))
)
(setq ss (ssget "x" (list (cons 8 la))))
(sssetfirst nil ss)
(princ)
)

wanhongron 发表于 2022-5-18 15:17:46

谢谢各位侠,start4444能支持多选满足我的想法
页: [1]
查看完整版本: 图层过滤改成手动灵活选择