ziele_o2k Posted May 21, 2018 Share Posted May 21, 2018 As topic says, how to check if object color is set to rgb. For example if I will manually set rgb color to 255,255,0 (yellow) - how to verify that this is true color and not aci? Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2018 Share Posted May 21, 2018 A vanilla check for this would be: (assoc 420 (entget e)) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 21, 2018 Share Posted May 21, 2018 ...And without DXF 430 (Colour Book) (defun rgb-p ( ent / enx ) (and (setq enx (entget ent)) (assoc 420 enx) (not (assoc 430 enx)) ) ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2018 Share Posted May 21, 2018 ...And without DXF 430 (Colour Book) Right! Quote Link to comment Share on other sites More sharing options...
ziele_o2k Posted May 21, 2018 Author Share Posted May 21, 2018 In meantime I started digging and I have new knowledge about true colors in acad (defun rgb-p ( obj / c ) (and (= (vla-get-colormethod (setq c (vla-get-truecolor obj))) 194 ) (= (vla-get-ColorName c) "") ) ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted May 21, 2018 Share Posted May 21, 2018 Heres how I'd write it: ; (rgbp (vlax-ename->vla-object (car (entsel)))) (defun rgbp ( o / c r ) (and (setq c (vlax-get o 'TrueColor)) (eq (vlax-get c 'ColorMethod) acColorMethodByRGB) (eq (vlax-get c 'ColorName) "") (setq r (mapcar ''((x) (vlax-get c x)) '(Red Green Blue))) ); and (and c (vl-catch-all-apply 'vlax-release-object (list c))) r ); defun rgbp But I'm not sure if the true color object property has to be released, justin case approach.. And would return either the rgb value or nil (if you require boolean return your will be faster). Quote Link to comment Share on other sites More sharing options...
ziele_o2k Posted May 21, 2018 Author Share Posted May 21, 2018 But I'm not sure if the true color object property has to be released, justin case approach.. In reference to Autolisp help: When an AutoLISP routine no longer uses an object outside AutoCAD, such as a Microsoft Excel object, call the vlax-release-object function to make sure that the associated application closes properly. So in my opinion you do not have to release color object because this is existing object and you are reading only it's properties. But now I have question, when do you guys are using vlax-release-object. I'm doing that only when I'm: - making truecolor object "AutoCAD.AcCmColor...." - playing with Excel - playing with XML Quote Link to comment Share on other sites More sharing options...
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.