Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

7 REPLIES 7
Reply
Message 1 of 8
fewik72296
508 Views, 7 Replies

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

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

7 REPLIES 7
Message 2 of 8
RPTHOMAS108
in reply to: fewik72296

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.

 

Message 3 of 8
fewik72296
in reply to: RPTHOMAS108

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

Message 4 of 8
RPTHOMAS108
in reply to: fewik72296

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. 

Message 5 of 8
fewik72296
in reply to: RPTHOMAS108

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.

Message 6 of 8
fewik72296
in reply to: fewik72296

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 😕

Message 7 of 8
RPTHOMAS108
in reply to: fewik72296

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.

Message 8 of 8
fewik72296
in reply to: RPTHOMAS108

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?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community