Is it always possible to avoid multiple transactions in a long process?

Is it always possible to avoid multiple transactions in a long process?

adam.krug
Advocate Advocate
529 Views
1 Reply
Message 1 of 2

Is it always possible to avoid multiple transactions in a long process?

adam.krug
Advocate
Advocate

I work on a command to create an assembly, rename it, create views and tag elements on these views.

 

My best wish is to have the whole process under one single transaction, so if user checks the undo list he/she sees one entry. My question is - is that even possible?

 

In my scenario I'm facing the below problems:

1. When you want to create brand new assembly and change it's type name you have to close one transaction after creating it and start a new one before renaming. Otherwise Revit doesn't see the assembly's type.

2. Tagging elements on unactivated views takes forever, thus I need to activate the newly created views for tagging the elements. I did a trick to activate them all outside of transaction and then start tagging elements in new one.

 

Unfortunately I end up having three entries on the undo list:

1. Creating assembly

2. Renaming it, creating views

3. Tagging

 

Is there any way I could have one entry? If I moved renaming to the end I could have two entries but still not one...

0 Likes
Accepted solutions (1)
530 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

Yes, sure!

 

Use a transaction group:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.53

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder