teknomatika 发表于 2022-7-6 06:34:44

在选择中按颜色选择

(defun c:SBC ( / c d e l )
   (if (setq e (car (entsel)))
       (progn
         (setq c
               (cond
                   (   (cdr (assoc 62 (entget e)))   )
                   (   (abs (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 (entget e)))))))   )
               )
         )                     
         (while (setq d (tblnext "LAYER" (null d)))
               (if (= c (abs (cdr (assoc 62 d))))
                   (setq l (cons "," (cons (cdr (assoc 2 d)) l)))
               )
         )
         (sssetfirst nil
               (ssget "_X"
                   (if l
                     (list
                           (cons -4 "<OR")
                               (cons 62 c)
                               (cons -4 "<AND")
                                 (cons 62 256)
                                 (cons 8 (apply 'strcat (cdr l)))
                               (cons -4 "AND>")
                           (cons -4 "OR>")
                     )
                     (list (cons 62 c))
                   )
               )
         )
       )
   )
   (princ)
)
(prompt "\nDigite: SBC")
 
我非常感谢你的帮助,改变这一极好的习惯:我觉得我做不到。
我打算做同样的工作,但不是在全球的绘图,但只有一个具体的选择。例程必须首先允许获得所需的颜色,然后过滤选择。

Lee Mac 发表于 2022-7-6 06:50:59

看起来很熟悉
 
从ssget表达式中删除“_X”。

teknomatika 发表于 2022-7-6 07:03:19

 
李,
美好的
又是坦克!

Lee Mac 发表于 2022-7-6 07:05:30

别担心

alanjt 发表于 2022-7-6 07:19:52

我发布的这个过滤选择例程可能很有趣:http://www.theswamp.org/index.php?topic=35028.msg402471#msg402471

alanjt 发表于 2022-7-6 07:33:07

不管怎样,我看到你也在层列表中进行匹配,而不仅仅是在对象级别。

teknomatika 发表于 2022-7-6 07:42:20

 
alanjt,
阿滕顿的坦克!
页: [1]
查看完整版本: 在选择中按颜色选择