Autodesk.Revit.DB.BuiltInFailures.ComponentRepeaterFailures
是一个枚举类型,用于标识与重复元件相关的失败消息。
名称 | 描述 |
---|---|
ATagNotSetForRepeater | 未为重复元件设置标记 |
ATagValueInvalidForRepeater | 重复元件的标记值无效 |
FailedToCopyInstancesForRepeater | 复制重复元件实例失败 |
InvalidRepeaterParamConfig | 重复元件参数配置无效 |
InvalidRepeaterStructuralLayoutConfig | 重复元件结构布局配置无效 |
InvalidTaggingOperationForRepeater | 重复元件标记操作无效 |
ReferencedInstanceNotFoundForRepeater | 无法找到重复元件的引用实例 |
ReferencedLevelNotFoundForRepeater | 无法找到重复元件的引用层 |
ReferencedGridNotFoundForRepeater | 无法找到重复元件的引用网格 |
ReferencedLineNotFoundForRepeater | 无法找到重复元件的引用线 |
ReferencedFamilySymbolNotFoundForRepeater | 无法找到重复元件的引用族类型符号 |
// 检测是否存在重复元件未设置标记的情况
var failures = new List<FailureMessageAccessor>();
var options = new FailureHandlingOptions
{
Document = document,
AdditionalFailuresPreprocessor = new BuiltInFailuresPreprocessor(),
FailuresCallback = new FailuresCallback(),
TreatWarningsAsFailures = true,
};
var failureFilter = BuiltInFailures.GeneralFailures.TagFailures;
var failureMessages = document.Validate(failureFilter, options);
foreach (var failureMessage in failureMessages)
{
if (failureMessage.GetFailureDefinitionId() == BuiltInFailures.ComponentRepeaterFailures.ATagNotSetForRepeater)
{
failures.Add(failureMessage);
}
}
if (failures.Count > 0)
{
// 在这里进行处理
}