IFailuresPreprocessor Interface


IFailures Preprocessor 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

The IFailuresPreprocessor type exposes the following members.

Methods
Name Description
Public method PreprocessFailures 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;
    }
}
See Also