0

I want Delete Maskined Region from Revit Document using C#. Error : Modifying is forbidden because the document has no open transaction. Exception: ModificationOutsideTransactionException

Dhiraj Lotake
  • 29
  • 1
  • 6

1 Answers1

1

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.

Community
  • 1
  • 1
Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44