[英]Delete Maskined Region from Revit Document using C#
I want Delete Maskined Region from Revit Document using C#. 我想使用C#从Revit文档中删除蒙版区域。 Error : Modifying is forbidden because the document has no open transaction.
错误:禁止修改,因为文档没有未清事务。 Exception: ModificationOutsideTransactionException
异常:ModificationOutsideTransactionException
You have 2 options: 您有2个选择:
change the TransactionMode to Automatic at the class attribute 将class属性的TransactionMode更改为Automatic
[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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.