Dayananda Posted November 13, 2019 Posted November 13, 2019 I need a code to select the all objects which same colour but inside difference blocks. After change the colour at once. Quote
dlanorh Posted November 13, 2019 Posted November 13, 2019 1 hour ago, Dayananda said: I need a code to select the all objects which same colour but inside difference blocks. After change the colour at once. What colour to what colour? Or did you mean all bylayer/byblock? 1 Quote
Dayananda Posted November 13, 2019 Author Posted November 13, 2019 2 hours ago, dlanorh said: What colour to what colour? Or did you mean all bylayer/byblock? True colour 255,0,0 to RED Quote
dlanorh Posted November 13, 2019 Posted November 13, 2019 2 hours ago, Dayananda said: True colour 255,0,0 to RED True colour 255,0,0 IS "RED" just using a index type Quote
ronjonp Posted November 13, 2019 Posted November 13, 2019 17 minutes ago, dlanorh said: True colour 255,0,0 IS "RED" just using a index type They are not the same. If the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62. Quote
dlanorh Posted November 13, 2019 Posted November 13, 2019 3 hours ago, ronjonp said: They are not the same. If the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62. I stand by my original statement. As colours they equate to the same RGB. If you pass ACI 1, ACI 10 or acRed into LeeMac's ACI->RGB converter function (below) the same RGB is returned, or is this function wrong? (defun LM:ACI->RGB ( c / o r ) (if (setq o (vla-getinterfaceobject (LM:acapp) (strcat "autocad.accmcolor." (substr (getvar 'acadver) 1 2)))) (progn (setq r (vl-catch-all-apply '(lambda ( ) (vla-put-colorindex o c) (list (vla-get-red o) (vla-get-green o) (vla-get-blue o)) ) ) ) (vlax-release-object o) (if (vl-catch-all-error-p r) (prompt (strcat "\nError: " (vl-catch-all-error-message r))) r ) ) ) ) ;; Application Object - Lee Mac ;; Returns the VLA Application Object (defun LM:acapp nil (eval (list 'defun 'LM:acapp 'nil (vlax-get-acad-object))) (LM:acapp) ) See also Here. The fact that certain AutoCAD commands handle the "TrueColor" property differently from the "Color" property and AutoCAD stores it with a different DXF code value doesn't detract from the fact that they equate to the same RGB colour. Quote
Dayananda Posted November 14, 2019 Author Posted November 14, 2019 10 hours ago, ronjonp said: f the object has truecolor and you're using a CTB file to plot, it will plot in color even if red ( 1 ) is set to another color. The object will also have DXF code 420 where as index color will only have code 62. That is why we need to change the color of the objects to red. True color printing in color and when change to red it can print in black. Quote
ronjonp Posted November 14, 2019 Posted November 14, 2019 18 hours ago, dlanorh said: I stand by my original statement. That's fine, but the OP's response validates that there is a difference even if the numbers are the same .. try it when plotting. Quote
ronjonp Posted November 14, 2019 Posted November 14, 2019 (edited) 13 hours ago, Dayananda said: That is why we need to change the color of the objects to red. True color printing in color and when change to red it can print in black. Give this a try: (defun c:foo (/ a d tc) (vl-load-com) (vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object)))) (cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a)))) ) (vlax-for b (vla-get-blocks d) (vlax-for o b (and (setq tc (vla-get-truecolor o)) (equal '(255 0 0) (mapcar '(lambda (x) (vlax-get tc x)) '(red green blue))) (progn (vla-put-colorindex tc 1) (vl-catch-all-apply 'vla-put-truecolor (list o tc))) ) ) ) (foreach l a (vlax-put l 'lock -1)) (princ) ) Edited November 14, 2019 by ronjonp 1 Quote
dlanorh Posted November 14, 2019 Posted November 14, 2019 1 hour ago, ronjonp said: That's fine, but the OP's response validates that there is a difference even if the numbers are the same .. try it when plotting. I appreciate that, I was coming at it from a colour perspective, printing/plotting wasn't mentioned in the initial post. 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.