K Baden Posted October 6, 2017 Posted October 6, 2017 Good morning all! I have a code that works perfectly for updating the color to the truecolor 255,255,255 for all solid hatching. Basically i just need this exact code, except i need it to update the color to ByBlock. Can anyone help me out? (defun c:hw (/ doc) (or *colorobject* (setq *colorobject* (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AutoCAD.AcCmColor." (substr (getvar "acadver") 1 2)) ) ) ) (if (null (vl-catch-all-error-p (vl-catch-all-apply 'vla-setrgb (list *colorobject* 255 255 255)))) (progn (vlax-for blk (vla-get-blocks (setq doc (vla-get-Activedocument (vlax-get-acad-object)))) (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (= "AcDbHatch" (vla-get-objectname obj)) (= "SOLID" (strcase (vla-get-patternname obj))) (vlax-write-enabled-p obj) ) (vl-catch-all-apply 'vla-put-truecolor (list obj *colorobject*)) ) ) ) ) (vla-regen doc acallviewports) ) ) (princ) ) (vl-load-com) (princ) Quote
ronjonp Posted October 6, 2017 Posted October 6, 2017 (defun c:hw (/ doc) (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object)))) (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (= "AcDbHatch" (vla-get-objectname obj)) (= "SOLID" (strcase (vla-get-patternname obj))) (vlax-write-enabled-p obj) ) (vl-catch-all-apply 'vla-put-color (list obj 0)) ) ) ) ) (vla-regen doc acallviewports) (princ) ) (vl-load-com) Quote
K Baden Posted October 6, 2017 Author Posted October 6, 2017 Beautiful thank you! I wasn't sure on how to get ByBlock without using the word ByBlock. I appreciate your help! 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.