IFailuresPreprocessor Interface

IFailuresPreprocessor Interface

An interface that may be used to perform a preprocessing step to either filter out anticipated transaction failures or to mark certain failures as non-continuable.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public interface IFailuresPreprocessor
Public Interface IFailuresPreprocessor
public interface class IFailuresPreprocessor
type IFailuresPreprocessor = interface end

The IFailuresPreprocessor type exposes the following members.

Methods
 NameDescription
Public methodPreprocessFailures This method is called when there have been failures found at the end of a transaction and Revit is about to start processing them.
Top
Remarks
This interface, if provided, is invoked when there are failures found at the end of a transaction. An instance of this interface can be set in the failure handling options of transaction object.
Example
public class RoomWarningSwallower : IFailuresPreprocessor
{
    public FailureProcessingResult PreprocessFailures(FailuresAccessor failuresAccessor)
    {
        IList<FailureMessageAccessor> failList = new List<FailureMessageAccessor>();
        // Inside event handler, get all warnings
        failList = failuresAccessor.GetFailureMessages(); 
        foreach (FailureMessageAccessor failure in failList)
        { 
            // check FailureDefinitionIds against ones that you want to dismiss, 
            FailureDefinitionId failID = failure.GetFailureDefinitionId();
            // prevent Revit from showing Unenclosed room warnings
            if (failID == BuiltInFailures.RoomFailures.RoomNotEnclosed)
            {
                failuresAccessor.DeleteWarning(failure);
            }
        }

        return FailureProcessingResult.Continue;
    }
}
Public Class RoomWarningSwallower
    Implements IFailuresPreprocessor
    Public Function PreprocessFailures(failuresAccessor As FailuresAccessor) As FailureProcessingResult Implements IFailuresPreprocessor.PreprocessFailures
        Dim failList As IList(Of FailureMessageAccessor) = New List(Of FailureMessageAccessor)()
        ' Inside event handler, get all warnings
        failList = failuresAccessor.GetFailureMessages()
        For Each failure As FailureMessageAccessor In failList
            ' check FailureDefinitionIds against ones that you want to dismiss, 
            Dim failID As FailureDefinitionId = failure.GetFailureDefinitionId()
            ' prevent Revit from showing Unenclosed room warnings
            If failID = BuiltInFailures.RoomFailures.RoomNotEnclosed Then
                failuresAccessor.DeleteWarning(failure)
            End If
        Next

        Return FailureProcessingResult.[Continue]
    End Function
End Class

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also