Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone
I am looking for a lisp to generate multiple hatch for multiple polygons separately?
Solved! Go to Solution.
Hi Everyone
I am looking for a lisp to generate multiple hatch for multiple polygons separately?
Solved! Go to Solution.
(defun c:mhatch (/ ang do-it doc hatch oname pname scl space ss)
(if (setq ss (ssget '((0 . "LWPOLYLINE,POLYLINE,CIRCLE,ELLIPSE"))))
(progn
(setq
scl (getvar 'hpscale)
ang (getvar 'hpang)
pname (getvar 'hpname)
hpassoc (if (= (getvar 'hpassoc) 1):vlax-true :vlax-false)
doc (vla-get-activedocument (vlax-get-acad-object))
space (if (= (getvar 'cvport) 1) (vla-get-paperspace doc) (vla-get-modelspace doc))
)
(vlax-for ent (vla-get-activeselectionset doc)
(setq
do-it nil
oname (strcase (vla-get-objectname ent))
)
(cond
((vl-string-search "CIRCLE" oname)(setq do-it t))
((and (vl-string-search "LINE" oname)(eq (vla-get-closed ent) :vlax-true))(setq do-it t))
((equal (vlax-curve-getstartpoint ent) (vlax-curve-getendpoint ent) 1e-6)(setq do-it t))
)
(if do-it
(progn
(setq hatch (vlax-invoke space 'addhatch acHatchObject pname hpassoc))
(vlax-invoke hatch 'appendouterloop (list ent))
(vlax-put hatch 'patternangle ang)
(vlax-put hatch 'patternscale scl)
(vla-evaluate hatch)
)
)
)
)
)
(princ)
)
Miljenko Hatlak
Can't you just use the regular Hatch command, and in its dialog box, check this option?
@giscivil92 Also look into the HPSEPARATE variable. Code is not needed for this task.
@Kent1Cooper Hello Kent thanks for sharing, actually I didn't know about this capability in Autocad, that's it I need
Thanks again