【问题标题】:Delete Maskined Region from Revit Document using C#使用 C# 从 Revit 文档中删除遮罩区域
【发布时间】:2015-07-18 20:53:13
【问题描述】:

我想使用 C# 从 Revit 文档中删除遮罩区域。 错误:修改被禁止,因为文档没有打开的交易。 异常:ModificationOutsideTransactionException

【问题讨论】:

    标签: revit revit-api


    【解决方案1】:

    你有两个选择:

    在类属性中将 TransactionMode 更改为 Automatic

    [Transaction(TransactionMode.Automatic)]
    

    在你的命令中打开一个事务

    Transaction tr = new Transaction(commandData.Application.ActiveUIDocument.Document);
    tr.Start("Command name here");
    
    // your code
    
    tr.Commit();
    

    还发布了here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-08
      相关资源
      最近更新 更多