Leland Leahy shares a routine he created for AutoCAD and its verticals that helps him change the color of layers that objects are on.
"The LISP routine below is a good way to quickly change all the layers of a certain color to another color without having to go through the dialog box."
(defun c:colorchange (/ c1 c2 ) (vl-load-com) (setq c1 (getint " What is the original color: ") c2 (getint " What is the new color: ")) (vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))(if (= c1 (vla-get-Color layer))(vla-put-Color layer c2))) (prin1) )
Notes from Cadalyst Tip Reviewer Brian Benton: This routine is very easy to use. Load it, then type colorchange on the Command line. Type in the value of the color you want to change, then type in the color you want it to be. The routine doesn’t change the color of the object; it changes the color of the layer it is on. If an object’s color is set to 1 (red), it won’t be changed. |