Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I have been using a functioning LISP that turns all the SOLID hatches to a specific hatch. Now I wanted to add a conditional filter for layers with
(wcmatch (vla-get-layer x) "*MASS*")
but I only obtain errors.
The two codes that I tried in AutoCAD 2021 and that return "nil" results are below. In the first I added it in line 5 and in the second in line 7:
(defun c:hdwsol2was ( / 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
(wcmatch (vla-get-layer x) "*MASS*")
(= "AcDbHatch" (vla-get-objectname obj))
(= "SOLID" (strcase (vla-get-patternname obj)))
(vlax-write-enabled-p obj)
)
(progn
(vla-setpattern obj achatchpatterntypepredefined "CORK")
(vla-put-patternscale obj 50)
)
)
)
)
)
(vla-regen doc acallviewports)
(princ)
)
(vl-load-com) (princ)
(defun c:hdwsol2was ( / 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 (wcmatch (vla-get-layer x) "*MASS*")
(and
(= "AcDbHatch" (vla-get-objectname obj))
(= "SOLID" (strcase (vla-get-patternname obj)))
(vlax-write-enabled-p obj)
)
(progn
(vla-setpattern obj achatchpatterntypepredefined "CORK")
(vla-put-patternscale obj 50)
)
)
)
)
)
(vla-regen doc acallviewports)
(princ)
)
(vl-load-com) (princ)
I'd appreciate it if anyone could point to my error.
Thank you.
Eloy
Solved! Go to Solution.