undo Mark and Back not working.!

undo Mark and Back not working.!

tanvikarekar22
Explorer Explorer
490 Views
6 Replies
Message 1 of 7

undo Mark and Back not working.!

tanvikarekar22
Explorer
Explorer

I am generating multiple drawings using while loop in autolisp. I want to generate drawing , save it with different name and undo everything then again add next drawing and save it. But there is problem while undo everything in drawing. I used (command "_.UNDO" "_Mark") and (command "_.UNDO" "_Back") commands to undo upto undomark but it is not working. I am attaching my lisp file here. Is there any solution to resolve my problem?

0 Likes
491 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

Could it be simply that those commands are commented out in your code?

 

;(command "UNDO" "Mark")

(setq DrawingName (GetCell (strcat "B" NewCount)))
(setq SrNo (GetCell (strcat "A" NewCount)))
(setq Point (GetCell (strcat "D" NewCount)))
(create_drawing Point SrNo NewCount)
(saveFile DrawingName)

;(command "_.UNDO" "_Back")

 

If that was just because they weren't working, then I don't see anything else obvious [EDIT:] unless you're using a non-English version of AutoCAD, since the underscore prefix isn't included in the Undo Mark step.

 

I have used those successfully in an AutoLisp command, namely ReverseDirection.lsp, >here<, so I don't think it's a problem with the command itself or those options.  I don't know whether studying the way they're used there will help you, but you can look.  It's different in calling for Undo Back only if the User asks for it, so its usage may not be really applicable in your situation.

 

Further EDIT:  What about instead using Undo BEgin and Undo End as the wrapper, followed by (command "_.u") ?

 

Kent Cooper, AIA
0 Likes
Message 3 of 7

mithmodern26
Community Visitor
Community Visitor

thanks of knowlege for ur commond

0 Likes
Message 4 of 7

tanvikarekar22
Explorer
Explorer

I am generating multiple drawings using while loop in autolisp. I want to generate drawing , save it with different name and undo everything then again add next drawing and save it. But there is problem while undo everything in drawing. I used (command "_.UNDO" "_Mark") and (command "_.UNDO" "_Back") commands to undo upto undomark but it is not working. I am attaching my lisp file here. Is there any solution to resolve my problem?

0 Likes
Message 5 of 7

tanvikarekar22
Explorer
Explorer

No, it's not because I comment it. It's not working properly so just run other program I comment down undoMark and undoBack command. I had also tried using (command "_.UNDO" "_Mark") instead of (command "UNDO" "Mark") but it still not working

Updated code be like-

(command "_.UNDO" "_Mark")

(setq DrawingName (GetCell (strcat "B" NewCount)))
(setq SrNo (GetCell (strcat "A" NewCount)))
(setq Point (GetCell (strcat "D" NewCount)))
(create_drawing Point SrNo NewCount)
(saveFile DrawingName)

(command "_.UNDO" "_Back")

 

Also I used undoBegin and undoEnd instead of mark and back, But it didn't undo whole drawing

0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant

Here's a crazy idea [which I will leave it to you to experiment with]....

 

Help for UNDO says it "Reverses the effect of commands."  Could it be that it needs some actual command(s) in between the Undo Mark and Back commands, to give it something to work with other than AutoLisp functions?

 

Does it work if you do something like this?

 

(command "_.undo" "_mark" "_.zoom" "0.99x")

.... do your stuff ....

(command "_.zoom" "_previous" "_.undo" "_back")

Kent Cooper, AIA
0 Likes
Message 7 of 7

Scottu2
Advocate
Advocate

Look in to the saveFile routine.

Does it perform a saveas or wblock?

0 Likes