TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: aaa120 on April 10, 2014, 12:58:08 AM

Title: How to merge all layer and keep all object its color ?
Post by: aaa120 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
Title: Re: How to merge all layer and keep all object its color ?
Post by: pBe 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)
)