1234567891011121314151617181920212223242526272829303132333435363738 |
- using Autodesk.Revit.DB;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FWindSoft.Revit
- {
- /// <summary>
- /// 事务扩展相关
- /// </summary>
- public static class TransactionExtension
- {
- /// <summary>
- /// 开始事务并设定预处理
- /// </summary>
- /// <param name="tran"></param>
- /// <param name="preprocessor"></param>
- /// <returns></returns>
- public static TransactionStatus StartWidthPreprocessor(this Transaction tran,IFailuresPreprocessor preprocessor)
- {
- FailureHandlingOptions failureOptions = tran.GetFailureHandlingOptions();
- failureOptions.SetFailuresPreprocessor(preprocessor);
- tran.SetFailureHandlingOptions(failureOptions);
- return tran.Start();
- }
- /// <summary>
- /// 以默认预处理开始事务
- /// </summary>
- /// <param name="tran"></param>
- /// <returns></returns>
- public static TransactionStatus StartWidthPreprocessor(this Transaction tran)
- {
- return StartWidthPreprocessor(tran, new ErrorWarningPreprocessor(false));
- }
- }
- }
|