查找hatch lisp以窗口选择多条闭合多段线并立即对其进行图案填充,但会根据当前图案填充设置生成单个图案填充对象。
遇到此代码,但是否无法基于当前图案填充设置
- (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)
- )
谢谢 |