Autodesk.Revit.DB.BuiltInFailures.ElectricityFailures
是一个.NET类,它为Revit软件中的电气系统故障提供了预定义的错误代码。
以下是Autodesk.Revit.DB.BuiltInFailures.ElectricityFailures
类中包含的枚举值:
11
12
13
14
15
Autodesk.Revit.DB.BuiltInFailures.ElectricityFailures
类中的枚举值可用于检测电气系统中的故障,并提醒用户采取必要的措施。
检测电气系统是否存在故障的示例代码:
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
// ...
public void CheckElectricityFailures(Document doc, UIDocument uidoc)
{
IList<FailureMessage> failures = new List<FailureMessage>();
FailureDefinitionId circuitLoadWarningId = new FailureDefinitionId(BuiltInFailures.ElectricityFailures.CircuitLoadWarning);
FailureDefinitionId circuitOverloadId = new FailureDefinitionId(BuiltInFailures.ElectricityFailures.CircuitOverload);
FailureDefinitionId circuitShortCircuitId = new FailureDefinitionId(BuiltInFailures.ElectricityFailures.CircuitShortCircuit);
FailureDefinitionId circuitGroundFaultId = new FailureDefinitionId(BuiltInFailures.ElectricityFailures.CircuitGroundFault);
FailureDefinitionId circuitPhaseUnbalanceId = new FailureDefinitionId(BuiltInFailures.ElectricityFailures.CircuitPhaseUnbalance);
failures = uidoc.Document.GetWarnings().Where(f => f.GetFailureDefinitionId() == circuitLoadWarningId ||
f.GetFailureDefinitionId() == circuitOverloadId ||
f.GetFailureDefinitionId() == circuitShortCircuitId ||
f.GetFailureDefinitionId() == circuitGroundFaultId ||
f.GetFailureDefinitionId() == circuitPhaseUnbalanceId).ToList();
if (failures.Count > 0)
{
TaskDialog dialog = new TaskDialog("电气系统故障检测");
dialog.MainInstruction = "您的电气系统可能存在以下故障:";
foreach (FailureMessage failure in failures)
{
dialog.MainContent += failure.GetDescriptionText() + "\n";
}
dialog.Show();
}
else
{
TaskDialog.Show("电气系统故障检测", "您的电气系统正常运行。");
}
}
Autodesk.Revit.DB.BuiltInFailures.ElectricityFailures
类中包含的错误代码仅限于电气系统的预定义失败模式。如果您需要检测其他类型的电气故障,您需要编写自定义代码。