(defun c:hsp(/ c e hpb itm olde p pts selp ss ss1 ss2 ss3)
(prompt "\nSelect the lines to split hatch: ")
(if (setq ss (ssget ":L" '((0 . "LINE,LWPOLYLINE,ARC"))))
(prompt "\nSelect the hatch to split: ")
(if (setq ss1 (ssget ":S:L" '((0 . "HATCH"))))
(command "_.undo" "_BE" "_ucs" "_W" "_plan" "")
(setq olde (getvar 'cmdecho)
hpb (getvar 'hpbound)
selp (getvar 'selectionpreview)
itm -1
fuzz 0.25)
(command ".-hatchedit" (ssname ss1 0) "_b" "_r" "_y"
"._extrude" "_L" "" "5")
(setq e (ssname ss (setq itm (1+ itm))))
(command "._imprint" "_L" e "n" "")
(setq c (vlax-ename->vla-object e)
p (vlax-curve-getpointatdist
(/ (vlax-curve-getdistatparam c (vlax-curve-getendparam c))
pts (cons p pts)
p (polar p (* pi 0.25) fuzz)
pts (cons p pts)
p (polar p (* pi 1.25) fuzz)
pts (cons p pts)
);; while
(command "._explode" "_L" "")
(setq ss2 (ssget "_P")
ss3 (ssget "_F" pts '((0 . "REGION"))))
(command "._erase" ss2 "_R" ss3 "")
(setq itm -1)
(setq e (ssname ss3 (setq itm (1+ itm))))
(command "_.hatch" "solid" e ""
"_.matchprop" ss1 "_L" ""
"_.draworder" "_L" "" "_B")
);; while
(command "erase" ss1 ss3 "")
);; progn
);; if
);; progn
);; if
(setvar 'hpbound hpb)
(setvar 'selectionpreview selp)
(setvar 'cmdecho olde)
(command "_ucs" "_P" "_zoom" "_P" "_.undo" "_E")
);; test