I'm implementing 'history' feature in my Objectarx application, like there is one in Photoshop, or some other applications. I have a dialog which is filled with actions when a certain command is finished. I keep track only on actions that my application performs, and they are all grouped in undo transaction, so 1 undo will return everything that my command does in AutoCAD.
My undo is working ok, but I'm wondering if I can make i possible to return several steps at once, or to return to certain step in undo history.
My undoable command code looks like this:
pUndo = acdbHostApplicationServices()->workingDatabase()->undoController(); pUndo->beginGroup(); acdbHostApplicationServices()->workingTransactionManager()->startTransaction(); //...code that draws all kinds of stuff acdbHostApplicationServices()->workingTransactionManager()->endTransaction(); pUndo->endGroup();
And then I insert in my history dialog new entry, by some name.
When undo is invoked in AutoCAD, whole thing goes back in one step, and it is nice, but I'd like to go to some 'named marker' back, if it is possible, to have possibility to go back 'n' steps , not using the loop.
Hi Damir,
There is not much API to directly work with the undo stack.
But from what you mention, the "Mark" and "Back" options in AutoCAD's undo command should be of some help.
You can set a mark and assign a name to it in your application, although AutoCAD does not know about the name.
When undoing based on the name, your application will know how many marks to undo.
Regards,
Balaji
Thank you for your reply.
That is what I have right now, I must call undo 'n' number of times, depending of how many marks I want to go back. There is no possibility of going back 17 marks in one shot, if I understand correctly?
I see your point.
Sorry, that isn't possible, the back option can only go back from one mark to the other.
Regards,
Balaji