Author Topic: Entity layer by colour  (Read 2386 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Entity layer by colour
« on: July 05, 2006, 10:38:40 AM »
Does anyone have a lisp that will sort the entities to layers by the colour of the entity.

I have a drawing that was made in chief architect and translated to cad, but all the entities are on 1 layer and the colours is changed.
I wish to send each object of colour to the co-orsponding layer.

ie. line with colour 5 change to layer 5, with colour by layer?

I may have to writen something, but time is of essence.

Any help would be greatly appreciated..

Damn architects, oh wait that me....  :lmao:

M-dub

  • Guest
Re: Entity layer by colour
« Reply #1 on: July 05, 2006, 10:42:50 AM »
Have you tried the QSelect command?  I think it should work for you...

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Entity layer by colour
« Reply #2 on: July 05, 2006, 10:58:02 AM »
Code: [Select]
(defun test (/ ss)
  (if (setq ss (ssget "_X"))
    (foreach x (mapcar (function entget)
                       (vl-remove-if (function listp) (mapcar (function cadr) (ssnamex ss)))
                    )
      (if (assoc 62 x)
(progn
  (entmod (subst (cons 8 (itoa (cdr (assoc 62 x)))) (assoc 8 x) x))
  (entupd (cdr (assoc -1 x)))
) ;_  progn
      ) ;_  if
    ) ;_  foreach
  ) ;_  if
) ;_  defun

M-dub

  • Guest
Re: Entity layer by colour
« Reply #3 on: July 05, 2006, 11:03:41 AM »
oops, after re-reading your first post, I see what you're trying to do.  Guess Qselect isn't what you're after... Sorry ;)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Entity layer by colour
« Reply #4 on: July 05, 2006, 11:08:16 AM »
Code: [Select]
(defun test (/ ss)
  (if (setq ss (ssget "_X"))
    (foreach x (mapcar (function entget)
                       (vl-remove-if (function listp) (mapcar (function cadr) (ssnamex ss)))
                    )
      (if (assoc 62 x)
(progn
  (entmod (subst (cons 8 (itoa (cdr (assoc 62 x)))) (assoc 8 x) x))
  (entupd (cdr (assoc -1 x)))
) ;_  progn
      ) ;_  if
    ) ;_  foreach
  ) ;_  if
) ;_  defun

Nice stuff !!
TheSwamp.org  (serving the CAD community since 2003)

Shade

  • Guest
Re: Entity layer by colour
« Reply #5 on: July 05, 2006, 11:32:46 AM »
Thanks ElpanovEvgeniy, works like a charm.

Thanks for the input M-dub, but i was using ssx and properties pullout. Slower then a lisp but faster then manual change.

 :-)

Bobby C. Jones

  • Swamp Rat
  • Posts: 516
  • Cry havoc and let loose the dogs of war.
Re: Entity layer by colour
« Reply #6 on: July 05, 2006, 01:21:39 PM »
I have a drawing that was made in chief architect and translated to cad,
Fnork! 

Oh wait.  Possibly they are billing C.A. as a BIM product and that was an undeserved fnork...although I did let one escape when I first read this and what's done can't be undone.  Oh well, I'll just have to leave it be :-)
Bobby C. Jones