Page 1 of 1

Clear undo stack

Posted: Tue Feb 11, 2014 5:27 pm
by sramp
Hello,
I'm building a custom tool and to help the user the tool creates some construction lines ( RLineEntity ). These lines will be deleted at the end by the script.
The tool works as expected, but I have some problems with the undo command, since I got a crash.
I suppose that references of construction lines are still in the undo stack.
Is there a way to reset the undo stack in a safe state?
Thanks
sramp

Re: Clear undo stack

Posted: Wed Feb 12, 2014 9:38 am
by andrew
If you create and delete everything in operations (RAddObjectsOperation, RDeleteObjectsOperation, ...), this should never be an issue.
Perhaps, you can post the relevant part of your code?

Re: Clear undo stack

Posted: Thu Feb 13, 2014 10:26 am
by sramp
There is an error in my logic and this is the real cause of the problem.

I create some lines ( undoable true )
....
I delete the lines ( undoable false )

If I set as undoable every operation everything works fine.
I could set not undoable the lines creation too, but this makes the tools less usable during the lines creation.

Re: Clear undo stack

Posted: Thu Feb 13, 2014 10:49 am
by andrew
Yes, undoable should actually always be true unless a file is being loaded.