Author Topic: How to merge all layer and keep all object its color ?  (Read 2004 times)

0 Members and 1 Guest are viewing this topic.

aaa120

  • Guest
How to merge all layer and keep all object its color ?
« on: April 10, 2014, 12:58:08 AM »
How to merge all layer and keep all object its color ?
Who has some vlx files can help me to achieve this goal ?
My native language is not English ,if you do not understand
my meaning ,please reply my post

pBe

  • Bull Frog
  • Posts: 402
Re: How to merge all layer and keep all object its color ?
« Reply #1 on: April 10, 2014, 04:45:19 AM »
How to merge all layer and keep all object its color ?
Who has some vlx files can help me to achieve this goal ?
My native language is not English ,if you do not understand
my meaning ,please reply my post

Not sure what "merge all layer" is, does that mean "only one layer for all entities" [except 0 i guess] but keeping the color property as is from the original layers color?

Guess we can assume all entity colors are not exclusively bylayer is it? so if it is not then leave the color as it is?


EDIT:
Code: [Select]
(defun c:demo (/ func_ mlist e ly)
(defun func_ (en l) (entmod (append en l)))
       
  (if (setq ss (ssget "_X"))
    (repeat (setq i (sslength ss))
      (setq e (entget (ssname ss (setq i (1- i)))))
      (if (not (assoc (setq ly (cdr (assoc 8 e))) mlist))
   (setq mlist
          (cons (cons ly (cdr (assoc 62 (tblsearch "Layer" ly))))
           mlist
          )
   )
      )
      (if (not (cdr (assoc 62 e)))
   (setq e (func_ e (list (cons 62 (cdr (assoc ly mlist)))))))
      (setq e (func_ e '((8 . "ALL"))));<--- Your preferred layer name
    )
  )(princ)
)
« Last Edit: April 10, 2014, 06:19:47 AM by pBe »