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

Transaction/Undo/Redo

alexisDVJML
Collaborator

Transaction/Undo/Redo

alexisDVJML
Collaborator
Collaborator

Navisworks Transactions are wonderful.
By using them to enclose multiple actions modifying the document, not only you gain an incredible speedup, but you also the user to Undo all of them at once.

Kuddos to Navisworks team for this and for supporting multi-level Undo/Redo.

This is a challenging thing to implement so again Kuddos for this (and yes I blame but I also compliment where due ;->)

 

Now my question:
While I cleanly encapsulate our plugin important action into a transaction, most of these also modify the plugin internal state.
Thus if user "Undo", we end up in inconsistent state.

As a workaround for now, for such operation that modify internal state, I also enclose it in a paired document StartDisableUndo/EndDisableUndo.

However ideally I would like to intercept the Undo/Redo to do our own stuff.

But I didn't find any dedicated event to attach to.
Any clue anyone?

Thanks.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Reply
532 Views
4 Replies
Replies (4)

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi,

 

I raised your issue to the Navisworks Engineering team and asked for their suggestion.

I will come back to you if I receive any response from the engineering team.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

alexisDVJML
Collaborator
Collaborator

Thanks!

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes

alexisDVJML
Collaborator
Collaborator

Any update?

 

I also have a related question re: Transaction, aka re: Document BeginTransaction, EndTransaction and IsActiveTransaction.

 

My asumption is transactions are single level aka we cannot have a transaction created inside a transaction?

In such case, provided I want to have generic methods that can be called either with a currently running transaction or not, I should/could check IsActiveTransaction and if true NOT create a transaction?

 

Also how this relate to Undo methods which are at least counted and thus support kind of multi-level?

 

Thanks.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes

alexisDVJML
Collaborator
Collaborator

Additional question: is there any recommandations/guidelines re: order of BeginProgress and BeginStransaction? Which one preferably to call first to begin and call last to end a Transaction, and does it make any difference at all?

 

Thanks.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes