Thanks Jeff, excellent detective work. It's easy to code around this (though coded blind).
I'll try to run this under 2000/2002 tomorrow, hopefully it won't toss too much egg on me face.
(defun c:HatchEm ( / *error* _HatchIt _HatchItSub version ss i space )
(cond
( (> 15 (setq version (atoi (getvar "acadver"))))
;; shreik! AutoCAD 14 and older
(princ "Upgrade your AutoCAD mang!\n")
(defun *error* (x) (princ))
(exit)
)
( (< 15 version)
;; AutoCAD 2004+
(defun _HatchItSub ( space )
(vlax-invoke
space
'AddHatch
acHatchStyleNormal ;; pattern type
"ANSI31" ;; pattern name
:vlax-false ;; associativity
AcHatchObject ;; hatch object type
)
)
)
( ;; AutoCAD 2000 / 2002
(defun _HatchItSub ( space )
(vlax-invoke
space
'AddHatch
acHatchStyleNormal ;; pattern type
"ANSI31" ;; pattern name
:vlax-false ;; associativity
)
)
)
)
(defun _HatchIt ( space object / hatch err )
(setq err
(vl-catch-all-apply
'(lambda ()
(setq hatch (_HatchItSub space))
(vlax-invoke
hatch
'AppendOuterLoop
(list object)
)
(vlax-invoke hatch 'Evaluate)
)
)
)
(if (vl-catch-all-error-p err)
(princ
(strcat
"Entity handle:"
(vla-get-handle object)
" caused this error: "
(vl-catch-all-error-message err)
)
)
)
)
(cond
( (setq ss
(ssget
'( (0 . "lwpolyline,polyline")
(-4 . "&")
(70 . 1)
)
)
)
(setq space
(vlax-get-property
(vlax-get-property
(vlax-get-acad-object)
'ActiveDocument
)
(if (eq 1 (getvar "cvport"))
'PaperSpace
'ModelSpace
)
)
)
(repeat (setq i (sslength ss))
(_HatchIt
space
(vlax-ename->vla-object
(ssname ss (setq i (1- i)))
)
)
)
)
)
(princ)
)