RVTDocs.com
Namespace: Autodesk.Revit.DB

IFailuresPreprocessor

Interface
Description:
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.
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.
Syntax
public interface IFailuresPreprocessor
Examples
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;
    }
}
IFailuresPreprocessor Interface Members:
Name Description
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.