I guess that I am misunderstanding the use of undo group, I am using the
following the following error trap to try to reset the
drawing back to it's original state.
If the function runs the (command "layer" "s" "P-FIXT-N" "") or reaches the
second "-insert" command it simply does an undo 1
completely ignoring the group, when the "esc" key is pressed. If the make
layer command was run and "esc" is pressed before the
second "-insert", the error handler is successful. When the command is
completed successfully an undo acts as a group. Is there an
explanation and/or work around for this?
In addition can anyone recommend a book that has in depth coverage of autolisp
concerning matters like this?
Thanks
Cliff
(defun c:test ()
(defun error_trap (errormessage)
(command "undo" "end")
(command "undo" "1")
(setq *error* error_back)
(graphscr)
(princ)
)
(setq error_back *error*)
(setq *error* error_trap)
(setvar "cmdecho" 1)
(command "undo" "group")
(if (tblsearch "LAYER" "P-FIXT-N")
(command "layer" "s" "P-FIXT-N" "")
(command "layer" "m" "P-FIXT-N" "c" "3" "P-FIXT-N" "lt" "CONTINUOUS"
"P-FIXT-N" "")
)
(princ "\nSelect insertion point for block: ")
(command "-insert" "pipedrop" "s" (getvar "dimscale") pause nil)
(princ "\nRotation angle: ")
(command "-insert" "pipedrop" "s" (getvar "dimscale") (getvar "lastpoint")
pause)
(command "undo" "end")
(setq *error* error_back)
)
Output:
....................
Command: undo Enter the number of operations to undo or
[Auto/Control/BEgin/End/Mark/Back] : end
Command: undo Enter the number of operations to undo or
[Auto/Control/BEgin/End/Mark/Back] : 1 -INSERT
Command:
- posted
18 years ago