OK, yippee, I've finally finished the routine I've been working on over the last month or so, but being sensible decided I should add an error handling routine, and put all my setting back after I'd finished.
I therefore put a call to the following at the start of my code:
(DEFUN sstate ()
(SETQ oldlay (GETVAR "clayer"))
(SETQ oldfil (GETVAR "filletrad"))
(SETQ oldtxt (GETVAR "textstyle"))
(SETQ oldsnap (GETVAR "osmode"))
(SETQ oldmtxt (GETVAR "mirrtext"))
(SETQ olderr *error*)
(SETQ *error* djeerror)
(PRINC "\nStates stored")
(PRINC)
(c:undos)
)
(DEFUN djeerror (errmsg)
(IF ;IF
(NOT errmsg) ;CONDITION
(SETQ errmsg "UNSPECIFIED ERROR") ;TRUE
) ;CLOSE IF
(PRINC (STRCAT "\nRoutine cancelled: " errmsg)) ;PRINT ERROR MESSAGE TO SCREEN
(rstate)
)
And a reference to the following at the end of my code:
(DEFUN c:rstate ( / oldlay oldfil oldtxt oldsnap oldmtxt olderr)
(SETVAR "clayer" oldlay)
(SETVAR "filletrad" oldfil)
(SETVAR "textstyle" oldtxt)
(SETVAR "osmode" oldsnap)
(SETVAR "mirrtext" oldmtxt)
(SETQ *error* olderr)
(c:undoe)
)
undos and undoe refer to simple undo start and stop function.
So I run my routine, and halfway through, press ESC to simulate an error. Ufortunately I just get the following on the command line:
Routine cancelled: Function cancelled; error: An error has occurred inside the
*error* functionAutoCAD variable setting rejected: "CLAYER" nil
I've tested it on the command land, and all of the getvars ar working, and if I do a manual setvar, that seems to work as well.
Can anybody suggest what I'm doing wrong?
DJE