woodman78 发表于 2022-7-6 09:18:20

Lisp从Byl更改颜色

是否有人有lisp,当选择实体时,它将采用bylayer颜色并将该颜色直接指定给实体,而不使用bylayer?

Lee Mac 发表于 2022-7-6 09:45:10

快速书写:
 
(defun c:test ( / a b c d e f )
(while (setq a (tblnext "LAYER" (null a)))
   (setq b (cons (cons (cdr (assoc 2 a)) (abs (cdr (assoc 62 a)))) b))
)
(if (setq c (ssget "_:L"))
   (repeat (setq d (sslength c))
   (setq e (entget (ssname c (setq d (1- d))))
         f (cons 62 (cdr (assoc (cdr (assoc 8 e)) b)))
   )
   (entmod (if (assoc 62 e) (subst f (assoc 62 e) e) (append e (list f))))
   )
)
(princ)
)

woodman78 发表于 2022-7-6 09:59:10

完美的谢谢李·麦克。

Lee Mac 发表于 2022-7-6 10:04:47

不客气,伍德曼

vnanhvu 发表于 2022-7-6 10:31:32

嗨,李。
你能进一步发展你的Lisp程序吗?例如:单击对象时,在框上显示数字颜色,而不更改bylayer。
非常感谢你。
页: [1]
查看完整版本: Lisp从Byl更改颜色