Reputation: 39
I want Delete Maskined Region from Revit Document using C#. Error : Modifying is forbidden because the document has no open transaction. Exception: ModificationOutsideTransactionException
Upvotes: 0
Views: 90
Reputation: 8604
You have 2 options:
change the TransactionMode to Automatic at the class attribute
[Transaction(TransactionMode.Automatic)]
open a transaction within your command
Transaction tr = new Transaction(commandData.Application.ActiveUIDocument.Document);
tr.Start("Command name here");
// your code
tr.Commit();
Also posted here.
Upvotes: 1