PedroT Posted November 17 Share Posted November 17 Hello! I've been using a lisp from Lee Mac that changes all solid hatch to other predefined pattern (a big thanks to him although I'm a silent user of his work, original post here). The lisp changes all hatch, including those in locked layers and both on model and paperspace. I've made a few minor changes (ask for scale) but I would link to ask for a selection set and don't have the knowledge for it. I guess it's probably simple, and if so can you guys help on this? (defun c:HHS ( / doc escala) (setq escala (getreal "\nEnter scale for ANSI31 hatch: ")) (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) ) (progn (vla-setpattern obj achatchpatterntypepredefined "ANSI31") (vla-put-patternscale obj escala) ) ) ) ) ) (vla-regen doc acallviewports) (princ) ) (vl-load-com) (princ) Cheers, Pedro T. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 19 Share Posted November 19 If you mean select a hatch and change its pattern across a selection then something like this. (defun c:wow ( / ss obj x) (prompt "\nSelect hatches ") (setq ss (ssget '((0 . "HATCH")( 2 . "SOLID")))) (if (= ss nil) (alert "no hatches selected\n\nWill exit") (progn (setq escala (getreal "\nEnter scale for ANSI31 hatch: ")) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (vla-setpattern obj achatchpatterntypepredefined "ANSI31") (vla-put-patternscale obj escala) ) ) ) (princ) ) (c:wow) Quote Link to comment Share on other sites More sharing options...
PedroT Posted November 21 Author Share Posted November 21 On 11/19/2023 at 1:33 AM, BIGAL said: If you mean select a hatch and change its pattern across a selection then something like this. Thanks so much Bigal that works great (I had to delete the last line, tho). Would it be possible to change hatch within blocks also? 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.