undo

Martin (archive)

Usenet Archive
Joined
Aug 1, 2000
Messages
245
Reaction score
0
i have made acode which selects some objects then run a command on them one by one but when i undo autocad undoe those commands one by one, i have tried undo-begin and undo-end but still same result, is there another way or i'm using it wrong, but in general autocad too issuing : undo-begin, ....commands..., undo-end , still typing u undoe those commands one by one.
martin
 
martin said:
i have made acode which selects some objects then run a command on them one by one but when i undo autocad undoe those commands one by one, i have tried undo-begin and undo-end but still same result, is there another way or i'm using it wrong, but in general autocad too issuing : undo-begin, ...commands..., undo-end , still typing u undoe those commands one by one.
martin
Look at the MARK option for the UNDO command. Type "UNDO" at the command line to see what I'm talking about.

bobb
 
blammo said:
Look at the MARK option for the UNDO command. Type "UNDO" at the command line to see what I'm talking about.

Look at the BACK option as well . . . .

bobb
 
Don't use Undo, Mark. A programmer should not use that option.

Undo, Begin and End are the correct ones. But in order to be effective, you need an error handler also.

Simple example:

(defun C:Test (/ *Error*)
(defun *Error* (msg) ; localized error handler, echo *no* messages (command "._Undo" "_End") (command "._U") (princ)) (command "._Undo" "_End") ; end any open undo group (command "._Undo" "_BEgin") ; start new group (command "._Line" pause pause "") (command "._Circle" pause pause) (command "._Undo" "_End")
(princ))
 
Bob,
When I am drafting, and I want to try something that may not work out, I sometimes set a mark. If I like what I've done I don't back up. If I see it heading nowhere, I can get back to the branch point in one undo back. If I had written a program that placed undo marks evertime I used it, rather than undo begin and ends, then it would short eliminate the unique benefits of the mark and back approach. With undo begin and end, the program can give the user 1 or more incremental undo steps that make sense. This avoids the user having an unknown number of undo's to undo the effect of the user created command.

Hope that helps.

Regards,
Doug
 
Thanks for an interesting discussion, now you've got me thinking...

When I put something like:

^C^CUNDO;M;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A;; N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;LayChk;

on a custom button, should I be using BEGIN and END? Would it be possible?
If so how?
 
Robert,
Thanks for the tip about using undo end before undo begin. Things are working better now.

Bill
 
Thanks!

In short it's: UNDO MARK followed by a few operations

which means I can type UNDO BACK to undo everything the button did.

I'm hoping that this BEGIN END business would put all the button's actions under one entry in AutoCAD's undo list, so that just pressing the undo button would work, instead of having to remember to type UNDO BACK.

....Well, writing that made me think clearer and I went back to the help files and now the new headache looks like this:

^C^CUNDO;BE;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A; ;N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;UNDO;E;LayChk;

and it works!

So thanks again Doug
 
Now your next headache to is make sure it uses AutoCAD's internal commands, and works in any language version of AutoCAD (something every menu macro should do).

Next! ;-)

--
R. Robert Bell, MCSE
www.AcadX.com

message | Thanks!
|
| In short it's: UNDO MARK followed by a few operations | | which means I can type UNDO BACK to undo everything the button did. | | I'm hoping that this BEGIN END business would put all the button's actions | under one entry in AutoCAD's undo list, so that just pressing the undo | button would work, instead of having to remember to type UNDO BACK. | | ...Well, writing that made me think clearer and I went back to the help | files and now the new headache looks like this:
|
|
^C^CUNDO;BE;-XR;D;*;-LAYER;U;*;ON;*;T;*;S;0;;REGEN;BlockLay;AUDIT;Y;PURGE;A; | ;N;PURGE;A;;N;PURGE;A;;N;PURGE;A;;N;UNDO;E;LayChk; | | and it works! | | So thanks again Doug | | | > HUW, | > Sorry but it gives me a headache to look at that. I'll let you decide. ;-) | > | |
 
Doing all menu customization in a separate menu that is then menuloaded makes the upgrade/installation process a no-brainer.
 

Member Recommended

Back
Top