gib65 Posted October 10, 2007 Posted October 10, 2007 Is there a way to automatically generate layers based on color? I just downloaded a CAD object that's only got 1 layer but several different colored lines. It would be extremely painstaking if I had to take each and every line and place it on a different layer. It would be much easier if I could tell AutoCAD 2006 to simply split the object up by color and place each one on a different layer. Is this possible? Quote
SLW210 Posted October 10, 2007 Posted October 10, 2007 You could use Qselect to select by color and add to a layer. Quote
Guest Alan Cullen Posted October 10, 2007 Posted October 10, 2007 Use the CHANGE command with FILTER to select all lines of a particular colour. Also check the threads listed at the bottom of this page for more advice. Quote
PS_Port Posted October 10, 2007 Posted October 10, 2007 Heres a lisp I butchered up, for your task. it will create layers by color number and place those colors on the appropriate layer. (defun c:lbc ( / SelectionSet counter EntData EntColor) (prompt "\nSelect the entitie(s) you want to create layers by color... ") (setq SelectionSet (ssget)) (if (not SelectionSet) (prompt "\n There was nothing selected! ") (progn (setq counter 0) (repeat (sslength SelectionSet) (setq EntData (entget (ssname SelectionSet counter)) EntColor (cdr (assoc 62 EntData)) );-setq (setq counter (1+ counter)) (command "-layer" "n" EntColor "c" EntColor EntColor "") (setq EntData (subst (cons 8 (rtos EntColor))(assoc 8 EntData) EntData)) (entmod EntData) (princ) );-repeat );-progn );-if );-defun (princ) but after reading Alan & SLW good answers I think I might have wasted my time. Quote
chulse Posted October 11, 2007 Posted October 11, 2007 See this thread for some additional lisps: http://www.cadtutor.net/forum/showthread.php?t=16337 Been a huge help for my work Quote
gib65 Posted October 11, 2007 Author Posted October 11, 2007 Thanks everyone. These suggestions did the trick. Quote
seegs Posted July 6, 2011 Posted July 6, 2011 Mate, this is why i'm (trying to) learning lisp, this worked PERFECTLY. I have over 200,000 lines, to process. selecting them all takes half a day. Using your lisp takes 5 seconds. THANKYOU Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.