RonnieMoore Posted November 8, 2013 Posted November 8, 2013 (edited) My error trapper crashes when (command "layer"...) is run. The following is returned. ; error: An error has occurred inside the *error* functionFunction The 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) ) Edited November 8, 2013 by RonnieMoore Quote
BlackBox Posted November 8, 2013 Posted November 8, 2013 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 Quote
SLW210 Posted November 8, 2013 Posted November 8, 2013 Please read the Code posting guidelines and edit your code to be in code tags. Quote
RonnieMoore Posted November 8, 2013 Author Posted November 8, 2013 (edited) Is this error handler localized within your main routine? No (defun C:TrackToolRT (/ *error*) (setq *error* MyExit) ... rest of main code (MyExit nil) ) Edited November 8, 2013 by RonnieMoore Quote
Lee Mac Posted November 8, 2013 Posted November 8, 2013 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) ) Quote
RonnieMoore Posted November 8, 2013 Author Posted November 8, 2013 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? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.