该文档介绍了Revit API中的 Autodesk.Revit.DB.BuiltInFailures.GridFailures
枚举类型,该枚举类型包含了Revit中可能出现的与网格相关的失败信息。
public enum GridFailures
值 | 描述 |
---|---|
BadSpacing | 网格线之间的距离不合理 |
OverlappingGrids | 重叠的网格 |
下面的代码演示如何捕获并处理 GridFailures
中的失败信息。
try
{
// Some code that may result in grid failures
}
catch (Autodesk.Revit.Exceptions.InvalidOperationException ex)
{
if (ex.FailureDefinitionId == Autodesk.Revit.DB.BuiltInFailures.GridFailures.BadSpacing)
{
TaskDialog.Show("Error", "Grid line spacing is not correct");
}
else if (ex.FailureDefinitionId == Autodesk.Revit.DB.BuiltInFailures.GridFailures.OverlappingGrids)
{
TaskDialog.Show("Error", "Grids are overlapping");
}
else
{
throw ex;
}
}