Hsanon 发表于 2022-7-5 20:04:09

层0中的颜色

您好,有人能告诉我一个例程,它将选定的对象(在单独的层上)移动到另一层(例如第0层),但对象需要保持与原始层(byblock)相同的颜色吗
 
我试图通过将它们全部推入一个单独的层来减少图形中的层数,但它们都变成了具有新层颜色的逐层,我无法区分各种元素。。。
 
谢谢

Tharwat 发表于 2022-7-5 20:14:50

尝试此例程,并根据目标层名称更改变量“lay”。
 

(defun c:Test(/ lay i ss sn)
;;; Tharwat 09.03.2015    ;;;
(setq lay "0") ;; <<= change the layer name as per your required one
(if
   (and (tblsearch "LAYER" lay)
      (princ
          (strcat "\n Select objects to move to layer < " lay " > ."))
      (setq i-1
            ss (ssget "_:L" '((0 . "~VIEWPORT"))))
      )
    (while (setq sn (ssname ss (setq i (1+ i))))
      (entmod
      (subst (cons 8 lay) (assoc 8 (setq e (entget sn))) e))
      )
    (princ
      "\n Failed !. Layer not found or nothing selected by the user ")
    )
(princ)
)

Hsanon 发表于 2022-7-5 20:20:37

我认为你想把对象移动到一个特定的层,并根据其原始层中的原始颜色重新给每个对象上色。
你的第一篇帖子没有给出任何关于这个目标的提示。但是无论如何,李在我看你的附图之前,走过来给了你一张。

Tharwat 发表于 2022-7-5 20:22:16

对不起,在我的帖子里没有说得太清楚。。。是的,这正是我需要的。。。李的节目也很管用!!!!
 
非常感谢你的帮助!!!!

Hsanon 发表于 2022-7-5 20:33:06

非常欢迎你,我很高兴它对你有用。

Hsanon 发表于 2022-7-5 20:36:44

李,仅供参考,名字叫沙农。。。。(不是“英语”刺耳)
我是一名50岁的建筑师。。。。我在年仅为岁一半的时候就开始学习autocad,涉猎过autolisp,并制作了一系列绘图程序,我现在仍在使用这些程序。然而,我现在失去了写作的本领。。。。。
我仍然在实践我的autocad工作。非常感谢您(以及网站上所有人)的帮助。
谢谢

Lee Mac 发表于 2022-7-5 20:41:38

Tharwat 发表于 2022-7-5 20:48:13

I think you want to move objects to a specific layer and re-color each object according to its original color in its original layer .
Your first post does not give any hint about this goal . but anyway Lee step over and gave you the one before I read your attached drawing .

Hsanon 发表于 2022-7-5 20:54:14

Sorry for not being too clear in my post... yes this was exactly what i needed... and Lee's program works !!!!
 
thanks so much for your help....!!!!

Lee Mac 发表于 2022-7-5 21:03:07

You're most welcome Hsanon - I'm glad it works for you.
页: [1] 2
查看完整版本: 层0中的颜色