Hi All
I have an error trap that I have been using for years and I recently notice that it was not really working correctly. When I purposely cause an error I get the following message:
Undoing. . .
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.
I typically add the top of all of my function (CM:ERR) which is loaded in my toolbox of functions. I am setting cm_undo_it within the routine I am having trouble with. Any help is greatly appreciated.
Manuel
Code:
(defun CM:ERR ()
(if (null *debug*)
(progn
(setq errfun *error*)
(defun *ERROR* (msg)(sys_err msg))
)
(setq *error* nil)
)
(princ)
)
(defun sys_err (errmsg /)
(if errfun (setq *error* errfun errfun nil))
(while (> (getvar "CMDACTIVE") 0)(command)) ;_ end while
(if (and errmsg (null (member errmsg '("Function cancelled" "quit / exit abort"))))
(princ (strcat "\n** Error: " errmsg " ** "))
)
(if cm_undo_it
(progn
(princ "\nUndoing. . . ")
(command ".undo" "end" ".undo" 1)
(setq cm_undo_it nil)
)
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object))) ;modified 1-22-09
)
(CM:MODER)
)