GermanLarraguibel Posted September 16, 2014 Posted September 16, 2014 Hi guys, I have a lot of drawing imported from another design software but he brings me true colors objects and what i need is change this colors to normal colors: From 0,128,0 to 94 (green) From 255,255,255 to 255 (White) From 100,60,30 to 27 (brown) From 31,26,23 to 250 (black) I need a lisp to make this changes automatically... Thanks, Quote
Stefan BMR Posted September 17, 2014 Posted September 17, 2014 Any object set to TrueColor holds the corresponding ACI, so the only thing you have to do is to remove 420 dxf code (that holds truecolor). ;Change all TrueColor to AutoCAD Color Index (defun c:all_to_aci ( / remove420 la e) (defun remove420 (entity_list) (entmod (vl-remove (assoc 420 entity_list) entity_list)) ) (while (setq la (tblnext "layer" (not la))) (remove420 (entget (tblobjname "layer" (cdr (assoc 2 la))))) ) (while (setq e (if e (entnext e) (entnext))) (remove420 (entget e)) ) (princ) ) PS1: I didn't test it on blocks, nested blocks or Xrefs. PS2: Something is wrong with your transformation: 0,128,0 is 96 and 100,60,30 is 39 Quote
GermanLarraguibel Posted September 17, 2014 Author Posted September 17, 2014 Thanks Stefan, The lisp Works Fine ! About the corresponding you are right. I just wanna change the colors to 94 and 27 because i have to obeying my CTB plot list. My archive contains only hatches ... no lines, no solidis, no blocks ! Thanks a lot ! Quote
handasa Posted February 9, 2016 Posted February 9, 2016 can you modify it please to be applied to nested blocks (block sub entities) Quote
Stefan BMR Posted February 9, 2016 Posted February 9, 2016 can you modify it please to be applied to nested blocks (block sub entities) Sure... ALL the objects, right? (defun c:all_to_aci ( / remove420 la en) (defun remove420 (entity_list) (vl-catch-all-apply '(lambda nil (entmod (vl-remove (assoc 420 entity_list) entity_list)))) ) (while (setq la (tblnext "layer" (not la))) (remove420 (entget (tblobjname "layer" (cdr (assoc 2 la))))) ) (vlax-for block (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (not (eq (vla-get-isxref block) :vlax-true)) (vlax-for en block (remove420 (entget (vlax-vla-object->ename en))) ) ) ) (princ) ) Quote
handasa Posted February 9, 2016 Posted February 9, 2016 work like a charm ... many thanks mr.Stefan BMR a gret job thanks again Quote
Stefan BMR Posted February 9, 2016 Posted February 9, 2016 You are welcome handasa. Thanks for mentioning the solution on TheSwamp too. Quote
Dennis Avenoso Posted March 27, 2023 Posted March 27, 2023 Can anyone create a lisp routine to change autocad defined color, say red (10) to RGB 253,155,155 which will give me the color and brightness I need. Have several other colors but once I get the syntax I can do the rest. Thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.