Is there a way to undo an entire lisp routine with one undo?
Here is my rod & shelf routine, and when it's done, if I undo, it steps thru the routine backwards...Is there something I can put in the routine so that if I'm undo-ing, it will treat what was done in the lisp as a single undo?
File can be downloaded above, and here is the code for visual here...
;; RodShelf.lsp
;; Created by Dominic Cesare
;; 01/23/2004
;;======================
;;Start of Routine
;;======================
(prompt "\nType RODSHELF to run.....")
(defun c:RODSHELF()
(setq temperr *error*)
(setq *error* trap1)
;stores current echo setting
(setq oldecho (getvar "cmdecho"))
;stores current layer
(setq oldlayer (getvar "clayer"))
(setvar "cmdecho" 0)
(COMMAND "-LAYER" "M" "PL-CAB" "C" "9" "" "")
(prompt "\nTRACE interior of closet.....")
; start pline
(command "._pline")
; while active command
(while (eq (logand (getvar "CmdActive") 1) 1)
; get user's input
(command pause)
;_ closes while
)
(setq PL (entlast))
;gets side to offset
(setq INT (getpoint "\nPICK POINT inside closet....." ))
;creating shelf line
(command "offset" "12.0" PL INT "")
(setq SHELF (entlast))
;creating rod line
(command "offset" "10.0" PL INT "")
(setq ROD (entlast))
;changing rod to correct layer and linetype
(command "change" ROD "" "P" "LT" "CENTER2" "")
(command "erase" PL "")
;sets echo to saved setting
(setvar "cmdecho" oldecho)
(setvar "clayer" oldlayer)
(setq *error* temperr)
(princ)
)
(defun trap1 (errmsg)
(command "u")
(setvar "cmdecho" oldecho)
(setvar "clayer" oldlayer)
(setq *error* temperr)
(prompt "Resetting System Variables...")
(princ)
)
;;======================
;; End of Routine
;;======================
[/url]