Revit二次开发之“事务”Transaction
start
end
[Transaction(TransactionMode.Automatic)]
[Regeneration(RegenerationOption.Automatic)]
public class theTransaction : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
Transaction ts = new Transaction(doc, "事务");
ts.Start();
//添加代码,若有失败则回滚
ts.Commit();
return Result.Succeeded;
}
}
[Regeneration(RegenerationOption.Automatic)]
public class theTransaction : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
Transaction ts = new Transaction(doc, "事务");
ts.Start();
//添加代码,若有失败则回滚
ts.Commit();
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。