AutoLisp Error Handling - Comm
My error trapper crashes when (command "layer"...) is run. The following is returned. ; error: An error has occurred inside the *error* functionFunctionThe error trapper works fine when (command "layer"...) is not included.
;====================== Error Trapper(defun MyExit (msg) (command "-layer" "off" "ToolTracker" "") (close file) (setvar "highlight" 1) (setvar "cmdecho" 1) (alert "Tool Tracker Stopped") (princ)) Is this error handler localized within your main routine?
Where are you restoring the default error handler, as your error handler is not doing so?
So that we might be able to better assist you, please post the rest of your code, as more information is needed.
Cheers Please read the Code posting guidelines and edit your code to be in code tags. Is this error handler localized within your main routine? No
(defun C:TrackToolRT (/ *error*) (setq *error* MyExit)... rest of main code (MyExit nil)) Is the error handler being used in conjunction with a reactor callback function?
Also:
[*] It would be better to ensure that the file symbol is correctly defined, rather than assume that it points to a file descriptor.
[*] System variables should be reset to their original values, not the values that you choose.
(defun myexit ( msg / ent ) (if (and (setq ent (tblobjname "layer" "ToolTracker")) (setq ent (entget ent)) ) (entmod (subst (cons 62 (- (abs (cdr (assoc 62 ent))))) (assoc 62 ent) ent)) ) (if (= 'file (type file)) (close file) ) (princ)) Lee Mac
Thanks. That method eliminates my error in my error trap. Any idea however, why the command version resulted in an error since it is suppose to accomplish the same thing?
页:
[1]