From the course: Revit: Creating C# Plugins

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Transactions

Transactions

From the course: Revit: Creating C# Plugins

Start my 1-month free trial

Transactions

- So far in the course we have used the Revit API to access elements and data from the Revit model although we haven't made any actual changes to the model. To do this we will need to learn about Revit transactions. Any changes that are made to the Revit model need to be encapsulated inside of an active transaction otherwise an exception will be thrown. We can create a transaction by using the transaction class. The transaction class, once instantiated, offers a few different methods to control a transaction. These are Start, Commit and Rollback. Start allows us to start a transaction, Commit commits any changes to the model and Rollback reverts any changes to before the transaction. Once an active transaction is committed the changes made inside the transaction become part of the model. It is important to note here that only one transaction can be active at one time. It is also important to enclose a transaction within a using or try-catch statement to ensure the transaction does not…

Contents