Dhiraj Lotake
Dhiraj Lotake

Reputation: 39

Delete Maskined Region from Revit Document using C#

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

Answers (1)

Augusto Goncalves
Augusto Goncalves

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

Related Questions