Transaction Manager

Transaction Manager

Anonymous
Not applicable
555 Views
5 Replies
Message 1 of 6

Transaction Manager

Anonymous
Not applicable
In an addin, I am trying to allow multiple operations and have my own
Undo and Redo on the form. I had it working for a while I thought, but
now it has quit, and I am not sure why.

I can undo the last transaction using oTxnMgr.UndoTransaction()
and in a watch window of oTxnMgr see that the UndoneTransactions.count
goes to 1. But then I start another transaction and the
Undonetransactions count goes to 0. I have tried using a different name
for the transaction, and tried dim'ing a new variable to store the new
transaction, to no avail.

Anyone have any idea what I might be doing wrong to cause starting a
new transaction to remove the Undone Transaction?
0 Likes
556 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
In most programs with an Undo feature, if you Undo and then do something else, it clears the Redo list. Is this not the same thing? Your Undone Transaction goes into the Redo List, and then you clear it inadvertently.
0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks Peter,

So the act of starting another transaction clears the Redo list? I guess I
never tried aborting the transaction and seeing if the redo list once again
shows the transaction.

This is something I have fought for quite some time.

I have a program where I have the user make a selection and then I draw some
client graphics, then they make another selection and I draw another client
graphics. They can do this a number of times until they are satisfied with
their selection. When they are satisfied they click a button and I
manipulate the components.

So if we aren't supposed to transact user interaction how do I make the 2 to
X number of client graphics and the final click and manipulation of
components all one transaction without including the user interaction?

Back when I originally wrote this addin, I don't think Interaction Graphics
were available. I haven't had a chance to play with Interaction Graphics
enough to know if it will persist on the screen through all the other
selections and view manipulations. Is it the way I should be going with
this? Think of the constraint dialog, the user selects something and the
face is highlighted along with a arrow being shown, they then select another
object and another highlight, and another arrow. Then the constraint is
committed. I need both arrows and the constraint to be one undo, but yet we
have user interaction in the middle of it.

--
KWiKMcad
Kent Keller
"peter.townsend" wrote in message news:6300443@discussion.autodesk.com...
In most programs with an Undo feature, if you Undo and then do something
else, it clears the Redo list. Is this not the same thing? Your Undone
Transaction goes into the Redo List, and then you clear it inadvertently.
0 Likes
Message 4 of 6

Anonymous
Not applicable
If I understand you correctly, you let the user click around, and you plop down a block or something where they clicked. And if the user cancels out, you want to undo these drops, which you're using the transactions for.

Interaction graphics will persist until you end them. If you rotate the camera, they'll still retain their original coordinates and will be seen from the new angle just fine.

What I might recommend in this case is to not plop down your blocks until the user hits OK. Instead, use the Interaction Graphics to put a simple frame in the location you would have placed your block. Record the information you need, and throw them all down at once at the end. If you do it this way, you would only need a single transaction at the very end where you're dropping the blocks. Canceling would entail the end of the interaction graphics, which will clear them away.

And if instead you're not actually modifying the document while the user clicks around making selections, you shouldn't be using transactions anyway. Only use them if the document gets edited.
0 Likes
Message 5 of 6

Anonymous
Not applicable
Peter,

Thanks. I am not placing anything "real" as the user clicks around, just
client graphics, which if I don't include them in my transaction they show
up as there own in the undo list. If I didn't include the user clicks along
with the drawing of the graphics and the final component manipulation, when
the user clicked undo, it would undo the component manipulation, but then
both client graphics would show back up, so they would have to click undo
again, and one client graphics would go away, and then another final undo
and the initial client graphics would be removed.

I will see if I can get interaction graphics working in place of the client
graphics I am using.

Thanks for your help.
--
KWiKMcad
Kent Keller
"peter.townsend" wrote in message news:6300669@discussion.autodesk.com...
If I understand you correctly, you let the user click around, and you plop
down a block or something where they clicked. And if the user cancels out,
you want to undo these drops, which you're using the transactions for.

Interaction graphics will persist until you end them. If you rotate the
camera, they'll still retain their original coordinates and will be seen
from the new angle just fine.

What I might recommend in this case is to not plop down your blocks until
the user hits OK. Instead, use the Interaction Graphics to put a simple
frame in the location you would have placed your block. Record the
information you need, and throw them all down at once at the end. If you do
it this way, you would only need a single transaction at the very end where
you're dropping the blocks. Canceling would entail the end of the
interaction graphics, which will clear them away.

And if instead you're not actually modifying the document while the user
clicks around making selections, you shouldn't be using transactions anyway.
Only use them if the document gets edited.
0 Likes
Message 6 of 6

Anonymous
Not applicable
No problem. Definitely see if you can use the Interaction Graphics for making a rough outline of whatever it is you're inserting. Making it draw lines isn't too terribly hard, though I do recall there being a couple typos in the API help.
0 Likes