We receive drawings that use many colors for layers which print oddly when using our .CTB file. I need to be able to automatically find all layers of a certain color and change these layers color to one that will plot correctly for us. Example: if several layers are set to bylayer color 30, it would find all of them and change the layer color to red or whatever we prefer. This would be great to be able to set up a table that would go through all the layers and save the selection set for each color and change only those, so if we want their RED for be YELLOW it won't select those we just changed to RED and make them YELLOW.
There's vs. Ours
MAGENTA TO YELLOW
GREEN TO WHITE
YELLOW TO GREEN
BLUE TO RED
You could use a layer property filter set to the color you want to change but if you have a lot of layers of color to change, this could be a tedious task. Search in the lisp forum to see if there may be a program all ready written if not then post a request there, maybe some there could write one for you.
You could setup a CAD Standard to check their drawings and the color of certain layer to match the standard. I could be wrong but I don't think it will detect the color A and change to color B globally, but change color of a layer from A to B. Meanwhile, you can always ask for their CTB to use when plotting their drawings.
;; this will replace colors for layers, and nested objects
;; find this line in the code and update it to fit yor CTB (setq Color-list '((4 7)(OldColor NewColor)(15 7)))
(defun update-colors-to-CTB ( / lay-obj color layers Block Blocks) (setq Color-list '((4 7)(15 7))) ;;; step 1 update LAYERS for a new color (setq layers (vla-get-layers (vla-get-activedocument(vlax-get-acad-object)))) ;;; update layers (vlax-for lay-obj layers (if(setq color(assoc(vla-get-Color lay-obj)Color-list)) (vla-put-Color lay-obj (last color)) ) ) ;;; 2 update BLOCKS for a new color (setq Blocks (vla-get-Blocks (vla-get-activedocument(vlax-get-acad-object)))) ;;; update objects (vlax-for Block Blocks (vlax-for obj Block (if(setq color(assoc(vla-get-Color obj)Color-list)) (vla-put-Color obj (last color)) ) ) ) (princ "Do not forget to update dim styles, Leaders and MLeaders") )
Access a broad range of knowledge to help get the most out of your products and services.