Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UNDO IN A GROUP

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
217 Views, 2 Replies

UNDO IN A GROUP

Does anyone have a function that will undo a lisp as a group. If i want to undo what i have drawn it makes me undo every step that the program has went through. I want to beable to hit undo one time.
2 REPLIES 2
Message 2 of 3
devitg
in reply to: Anonymous

From the ACAD help

Begin, End

Groups a sequence of actions into a set. After you enter the Begin option, all subsequent actions become part of this set until you use the End option. Entering undo begin while a group is already active ends the current set and begins a new one. UNDO and U treat grouped actions as a single action.

If you enter undo begin without undo end, using the Number option undoes the specified number of commands but does not back up past the begin point. If you want to go back to before the begin point, you must use the End option, even if the set is empty. The same applies to the U command. A mark placed by the Mark option disappears inside an UNDO group.

Message 3 of 3
Anonymous
in reply to: Anonymous


Hi djdaugherty,

 

Here is my two cents. The way I do it is using
VLISP, because (command) function is not working with the reactors. So
(vl-load-com) should be loaded and in most of the situations a variable for
the active document is defined, let's say something as:

 

(setq ACTVEDOCUMENT (vla-get-activedocument
(vlax-get-acad-object)))

 

Then, in the begining of the sequence to be
treated as a single step, I use the statement:

 

(setq UNDO_MARK (progn (vla-StartUndoMark
ACTVEDOCUMENT) T))


This will initialise the variable UNDO_MARK at the same time with the
(vla-StartUndoMark ACTVEDOCUMENT) call, and at the end of the LISP sequence, I
use the following statement:

 

(setq UNDO_MARK (vla-EndUndoMark ACTVEDOCUMENT))

 

which sets the variable UNDO_MARK back to nil and this way, if an error
occurs while the code is running, the errour routine checks the variable
UNDO_MARK and if it's not nil (that means that my code didn't have the
opportunity to end the UNDO group) it will call (vla-EndUndoMark
ACTVEDOCUMENT), so when an error occurs, I still have a chance to close the UNDO
grouping.

 

HTH

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Does
anyone have a function that will undo a lisp as a group. If i want to undo
what i have drawn it makes me undo every step that the program has went
through. I want to beable to hit undo one time.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report