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.
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."
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.
You can select wanted color entities with _qselect and make unvisible with this code:
Or possible to write program which can translate colors to layers with corresponding names.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
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."
Registered forum members do not see this ad.
Try this: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.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 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.
Bookmarks