Jump to content

All solid hatching within blocks color change edit - need help


K Baden

Recommended Posts

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)

Link to comment
Share on other sites

(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)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...