- (defun f (n a b / doc blkdef)
- (if (not
- (VL-CATCH-ALL-ERROR-P
- (setq blkdef
- (VL-CATCH-ALL-APPLY
- 'vla-item
- (list
- (vla-get-blocks
- (setq doc
- (vla-get-ActiveDocument
- (vlax-get-acad-object)
- )
- )
- )
- n
- )
- )
- )
- )
- )
- (progn
- (vlax-for o blkdef
- (if (and
- (= "AcDbHatch" (vla-get-ObjectName o))
- (= (strcase a) (strcase (vla-get-PatternName o)))
- )
- (VL-CATCH-ALL-APPLY
- 'vla-SetPattern
- (list o
- (vla-get-PatternType o)
- b
- )
- )
- )
- )
- (vla-regen doc :vlax-true)
- )
- )
- )
|