+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Super Member JBullseye74's Avatar
    Discipline
    Construction
    JBullseye74's Discipline Details
    Occupation
    Facade Designer
    Discipline
    Construction
    Using
    AutoCAD 2013
    Join Date
    Feb 2006
    Location
    UK North West
    Posts
    768

    Default Isolate Layer colour

    Registered forum members do not see this ad.

    Bonjour,

    Right i've got thie drawing and its all drawn on the same layer. (nice)

    But they have been kind and used different colours

    Obviously i can't isolate the layer as there is only one!! However it would be nice if i could isolate a colour.... is this possible?

    Ta
    AutoCAD 2010

    '"Accept that some days you're the pigeon, and some days you're the statue."

  2. #2
    Senior Member Cymro's Avatar
    Using
    AutoCAD 2008
    Join Date
    Jul 2006
    Location
    Gwynedd Wales
    Posts
    165

    Default

    You can use qselect to select everything a particular colour, then change properties to move the entities to a new layer which can be isolated.

  3. #3
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    You can select wanted color entities with _qselect and make unvisible with this code:

    Code:
    (defun c:unvisible(/ objLst objLst sucCount errCount)
      (vl-load-com)
      (princ "\n<<< Select object to make unvisible >>> ")
      (if
        (setq objSet(ssget))
        (progn
          (setq objLst
    	     (mapcar 'vlax-ename->vla-object
                        (vl-remove-if 'listp
                         (mapcar 'cadr(ssnamex objSet))))
    	    sucCount 0
    	    errCount 0); end setq
          (foreach obj objLst
    	(if
    	  (vl-catch-all-error-p
    	    (vl-catch-all-apply
    	      'vla-put-visible
    	      (list obj :vlax-false)))
    	(setq errCount(1+ errCount))
    	(setq sucCount(1+ sucCount))
    	); end if
          ); end foreach
      (princ
        (strcat "\n"(itoa sucCount) " becomes unvisible "
    	    (if(/= 0 errCount)
    	      (strcat ", " (itoa errCount) " were on locked layer! ")
    	      ""); end if
    	    ); end strcat
         ); end princ
        ); end progn
      ); end if
      (princ)
      ); end of c:unvisible
    
      
    (defun c:visible(/ objLst objLst sucCount errCount)
      (vl-load-com)
      (setq sucCount 0
    	errCount 0
    	objSet(ssget "_X" '((60 . 1)))
    	); end setq
      (if objSet
        (progn
         (setq objLst
    	     (mapcar 'vlax-ename->vla-object
                        (vl-remove-if 'listp
                         (mapcar 'cadr(ssnamex objSet)))))
      (foreach obj objLst
    	(if
    	  (vl-catch-all-error-p
    	    (vl-catch-all-apply
    	      'vla-put-visible
    	      (list obj :vlax-true)))
    	(setq errCount(1+ errCount))
    	(setq sucCount(1+ sucCount))
    	); end if
          ); end foreach
          (princ
            (strcat "\n"(itoa sucCount) " becomes visible "
    	    (if(/= 0 errCount)
    	      (strcat ", " (itoa errCount) " were on locked layer! ")
    	      ""); end if
    	    ); end strcat
           ); end princ
         ); end progn
        (princ "\n<<< Unvisible objects not found >>> ")
        ); end if
      (princ)
      ); end of c:visible
    Or possible to write program which can translate colors to layers with corresponding names.

  4. #4
    Super Member JBullseye74's Avatar
    Discipline
    Construction
    JBullseye74's Discipline Details
    Occupation
    Facade Designer
    Discipline
    Construction
    Using
    AutoCAD 2013
    Join Date
    Feb 2006
    Location
    UK North West
    Posts
    768

    Default

    Ta guys but im strugglin to use QSELECT im picking yellow and it doesn't select all of the yellow lines..!! hmmm
    AutoCAD 2010

    '"Accept that some days you're the pigeon, and some days you're the statue."

  5. #5
    Senior Member Cymro's Avatar
    Using
    AutoCAD 2008
    Join Date
    Jul 2006
    Location
    Gwynedd Wales
    Posts
    165

    Default

    Quote Originally Posted by JBullseye74 View Post
    Ta guys but im strugglin to use QSELECT im picking yellow and it doesn't select all of the yellow lines..!! hmmm
    Whats left over could be colour 50 or blocks.
    If you have changed the yellow to a new layer using qselect. check whats left over that looks yellow. then repeat qselect.

  6. #6
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540

    Default

    Registered forum members do not see this ad.

    Try this:
    Code:
    (defun c:tolayer( / en el col)
      (setq en (entnext))
      (while en
        (setq el (entget en)
       col (assoc 62 el)
       )
        (if col (setq el (subst
             (cons 8 (strcat "lay " (itoa (cdr col))))
             (assoc 8 el)
             el)
        el (entmod el))
          )
        (setq en (entnext en))
        )
      (princ)
      )
    The routine will examine each entity in the drawing. If there is a color override -it will move it on the layer named after that color. At the first occurence of a new color a new layer will be created.
    The objects without color specification should remain where they are.
    It worth a note the color of entities within blocks; you may have say a red and a white line in a block placed on the layer 0 and having (the block) no color override. In this case the block (with all its content) will remain in place.
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

Similar Threads

  1. layer isolate/freeze - express tool
    By happyunited in forum AutoCAD Drawing Management & Output
    Replies: 13
    Last Post: 21st Feb 2007, 12:43 am
  2. Xref Not Updating With Layer Colour Change After Reload
    By Unick in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 20th Sep 2006, 07:16 pm
  3. Layer Lock Isolate Button
    By Brunello19 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 10th Dec 2005, 03:23 am
  4. Change the colour of a layer in 1 viewport
    By CIMON in forum AutoCAD General
    Replies: 2
    Last Post: 10th May 2005, 06:10 pm
  5. Isolate changes to just one block
    By hyposmurf in forum AutoCAD General
    Replies: 10
    Last Post: 16th Jul 2003, 02:53 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts