After the RevitAddinWizard is installed, the FailuresProcessing Handler Coder can be found from both the Revit Addin Coder submenu under the Tools and the Revit Addin Coder toolbar:
If the toolbar does not appear by default, it can be turned on from the toolbar context menu:
Before launching the coder wizard, please place the cursor (through inserting while spaces or tabs) at a proper position inside of a FailuresProcessing event handler:
In the wizard, check failure severities and categories and input a transaction name if the failure processing applies to it only:
Click the OK button when ready.
Now the Revit FailureProcessing Hanlder Coder will take care of all other stuffs and will automatically generate some similar code like we talked about earlier:
private static List<FailureDefinitionId> FailureDefinitionIdList
{
get
{
List<FailureDefinitionId> list = new List<FailureDefinitionId>();
list.Add(BuiltInFailures.OverlapFailures.WallSpaceSeparationOverlap);
list.Add(BuiltInFailures.OverlapFailures.WallsOverlap);
list.Add(BuiltInFailures.OverlapFailures.WallRoomSeparationOverlap);
list.Add(BuiltInFailures.OverlapFailures.WallAreaBoundaryOverlap);
list.Add(BuiltInFailures.OverlapFailures.SpaceSeparationLinesOverlap);
list.Add(BuiltInFailures.OverlapFailures.RoomSeparationLinesOverlap);
list.Add(BuiltInFailures.OverlapFailures.LevelsOverlap);
list.Add(BuiltInFailures.OverlapFailures.DuplicateRebar);
list.Add(BuiltInFailures.OverlapFailures.DuplicatePoints);
list.Add(BuiltInFailures.OverlapFailures.DuplicateInstances);
list.Add(BuiltInFailures.OverlapFailures.CurvesOverlap);
list.Add(BuiltInFailures.OverlapFailures.AreaBoundaryLinesOverlap);
return list;
}
}
public static void AppEvent_FailuresProcessing_Handler(Object sender, EventArgs args)
{
FailuresProcessingEventArgs fpArgs = args as FailuresProcessingEventArgs;
FailuresAccessor accessor = fpArgs.GetFailuresAccessor();
if (!accessor.GetTransactionName().Equals("MyCommand"))
{
return;
}
foreach (FailureMessageAccessor msgAccessor in accessor.GetFailureMessages())
{
FailureDefinitionId id = msgAccessor.GetFailureDefinitionId();
if (!FailureDefinitionIdList.Exists( e => e.Guid.ToString() == id.Guid.ToString()) )
{
continue;
}
if (msgAccessor.GetSeverity() == FailureSeverity.Warning)
{
accessor.DeleteWarning(msgAccessor);
continue;
}
}
fpArgs.SetProcessingResult(FailureProcessingResult.Continue);
}
Links to some related articles:
Manage Revit Application Events of Revit API
Use RevitAddinWizard to Add Revit Application Event Handlers of Revit API
Implement Revit FailuresProcessing Event Hanlders of Revit API
Use RevitAddinWizard to Implement Revit FailuresProcessing Event Hanlders of Revit API
Manage Revit UIApplication Events
Manage Revit Document Events of Revit API - 3 Document Event Handler of RevitAddinWizard
Recent Comments