Our corporate Autocad standards recently change from all drawings having a black background to all drawings having a white background. This renders many of our layers to become invisible when opened in a white background. I have to spend hours going thru drawings changing all light colors to dark colors in order to be seen against a white background. Is there anything that can be done to make this task easier?
Solved! Go to Solution.
Solved by p_mcknight. Go to Solution.
If you were to make a list of the colors that you currently use crossed to the colors that you would like to use it wouldn;t be too difficult to write a small program that you could run on your drawings to change everything for you in a single command. If you make the list, I'll help with the program.
Below is a pretty simple command to translate the layer colors from whatever they are currently to something new. I started an arbitrary translation list in the program. You will need to modify it to suit your needs/colors. Do you know how to modify lisp programs and run them in AutoCAD? If you need help with that then let me know. The program will only work with indexed colors. If you guys assign true colors or such to any of your layers we will need to modify the program to work with those as well. I hope this helps some.
(defun c:changecolors ( / layerList d l cross)
(setq layerList '((7 15) (11 16) (80 17) (94 18) (50 19) (54 20) (42 21) (65 22))) ;First number is the current color, second is the new color
(setq d (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for l (vla-get-layers d)
(terpri)
(princ (vla-get-color l))
(if (setq cross (assoc (vla-get-color l) layerList))
(vla-put-color l (cadr cross))
)
(princ " : ")
(princ (vla-get-color l))
(princ " : ")
(princ (vla-get-name l))
)
(vla-regen d acallviewports)
(alert "Translation complete. ")
(princ)
)
(vl-load-com) (princ)
Thanks for the program but there is no real standard list of template colors and template names. The main color that we have issues with is yellow. If the LSP would find any layer with a color of yellow (whatever that index is) and change it to black, that would accomplish 90% of what I am trying to do.
Yellow is index 2 and white/black is index 7. That said replace
(setq layerList '((7 15) (11 16) (80 17) (94 18) (50 19) (54 20) (42 21) (65 22)))
with just
(setq layerList '((2 7)))
and run the program. Alternatively, if you want black instead of AutoCADs default white/black you could replace the 7 with 255.
Let me know if this works for you. Also, if you go in the color index you could create a general list with all of the light colors replacing to 7. It wouldn't be too hard to change the program to accept a range of colors to replace but I'll leave that to you if you would like to go that route.