Autodesk.Revit.DB.BuiltInFailures.DPartFailures是Revit API中的一个枚举类型,用于描述Revit中DPart(Design Part)的可能失败原因。
private FailureDefinitionId CreateDPartDuplicationFailure()
{
var failureDefinitionId = new FailureDefinitionId(new Guid("528C9943-3C3E-4DF2-A380-A2BC2ACE867F"));
var failureDefinition = FailureDefinition.CreateFailureDefinition(failureDefinitionId, FailureSeverity.Error, "DPart Duplication Failure");
FailureMessage message = new FailureMessage(failureDefinition, failureDefinition.GetDefaultResolutionType(), "Duplicate DPart names are not allowed.");
message.AddCondition(DPartFailureCondition(DPartFailures.DuplicateDPartName));
FailureHandlingOptions options = FailureHandlingOptions.GetDefaultOptions();
options.SetFailuresPreprocessor(new DPartFailuresPreprocessor());
FailureMessages.SetFailureHandlingOptions(message, options);
return failureDefinitionId;
}