Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Is there any way to do transactions without Undo/Redo?

fewik72296
Explorer

Is there any way to do transactions without Undo/Redo?

fewik72296
Explorer
Explorer

Hi, I am making a tool that syncs some meshes with a server and for each change I create a new transaction. It works well and all, but I have this problem that Revits Undo/Redo queue is all filled with my transactions. 

There are two issues wth this,

a) I don't want the user to undo a synch that should be happening by itself

b) The user can't undo what he does because the queue is filled with synchronizations.

 

Is there a way to do transactions without them being present in Undo/Redo queue?

 

Thank you

Reply
747 Views
7 Replies
Replies (7)

RPTHOMAS108
Mentor
Mentor

You can cut down on the number of items on the undo stack by wrapping transactions in a TransactionGroup and using Assimilate.

 

You can't eliminate them altogether unless you are using IUpdater to make the changes.

 

fewik72296
Explorer
Explorer

So moving my modifications to IUpdater would make them not show up in undo/redo?

RPTHOMAS108
Mentor
Mentor

IUpdater doesn't use transaction to make modifications they are transparent. It also doesn't encounter worksharing conflicts but that also means the changes may not stick if there are such conflicts (no notification I believe).

 

You wouldn't choose an IUpdater just to avoid undo items. The purpose of an IUpdater is to make changes to the model in response to other changes. 

0 Likes

fewik72296
Explorer
Explorer

That kinda seems to be my situation and only solution. If I reduce the number of transactions, the user can still undo them and it will interfere with his work. He will still be able to remove what my addin did.

fewik72296
Explorer
Explorer

So I've looked into the IUpdaters and it seems like I misunderstood it slightly. 

Do I have it right that IUpdater is only called during a added/modified/deleted transaction?

 

What I am doing is updating stuff for the user, so my changes need to happen continously regardles of user input. So IUpdater can't really do what I need, right?

 

At the same time, if do a transaction with an IUpdater, then that transaction can still get UNDOed or Redone, right?

 

If I understood it right, than it seems there is no way for me to sync out of Revit data without destroying a users undo/redo queue 😕

0 Likes

RPTHOMAS108
Mentor
Mentor

The question would be what triggers the change you require?

 

If it is something in Revit such as covered by:

Element.GetChangeTypeAny/Addition/Deletion/Geometry/Parameter

 

Then IUpdater is fine for your purpose. However, if change is triggered by something external to Revit then no. For that you would typically use IExternalEventHandler which then requires a transaction.

 

You can't start a transaction with IUpdeter it is forbidden.

0 Likes

fewik72296
Explorer
Explorer

Yes, the change triggers externaly. So I guess my current implementation is the only way to do it.

 

Is there any other way to prevent a transaction from creating Undo/Redo?

0 Likes