Okay, so I've decided to go another route with this and send all hatch to the back just prior to saving. I've been messing around with some reactor code and can't seem to figure out why it's not working. Here's what I've got...
(defun Hatch2Back ( / ss)
(if (setq ss (ssget "x" '((0 . "HATCH"))))
(command "_.draworder" ss "")
)
(princ)
)
(defun VLR_COMMAND-IT ()
(vl-load-com)
(vlr-command-reactor nil '((:vlr-commandWillStart . startCommand)))
(vlr-command-reactor nil '((:vlr-commandEnded . endCommand)))
(vlr-command-reactor nil '((:vlr-commandCancelled . cancelCommand)))
)
(defun startCommand (calling-reactor startcommandInfo / thecommandstart)
(cond
((= thecommandstart "SAVE") (Hatch2Back))
((= thecommandstart "QSAVE") (Hatch2Back))
((= thecommandstart "SAVEAS")(Hatch2Back))
)
)
(defun endCommand (calling-reactor endcommandInfo / thecommandend)
;;; Do something here....
)
(defun cancelCommand (calling-reactor cancelcommandInfo / thecommandcancel)
;;; Do something here...
)
(VLR_COMMAND-IT) ; Auto-load the reactors
(princ)
If I manually run the HATCH2BACK command, it works, but not when the command is issued in AutoCAD but I don't know where I'm going wrong with this.