添加项目文件。
This commit is contained in:
24
DotNet.Revit.ExternalEvent/DocumentExtension.cs
Normal file
24
DotNet.Revit.ExternalEvent/DocumentExtension.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DotNet.Revit.ExternalEvent
|
||||
{
|
||||
public static class DocumentExtension
|
||||
{
|
||||
public static void Invoke(this Document doc, Action<Transaction> action, string name = "INVOKE")
|
||||
{
|
||||
using (var tr = new Transaction(doc, name))
|
||||
{
|
||||
tr.Start();
|
||||
action(tr);
|
||||
|
||||
if (tr.GetStatus() == TransactionStatus.Started)
|
||||
tr.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user