A few weeks ago, Konrad Sobon, posted a Python script for exporting all the possible Revit warnings to use in a Dynamo script that analyzes and ranks the warnings in the current model. Since I mostly work in C#, I took his Python script and created a C# macro. I’ve had several requests for it, so here it is…
public void ExportWarnings()
{
try
{
using (StreamWriter writer = new StreamWriter(@"C:tempwarnings.txt"))
{
FailureDefinitionRegistry failures = Autodesk.Revit.ApplicationServices.Application.GetFailureDefinitionRegistry();
IList<FailureDefinitionAccessor> failuresList = failures.ListAllFailureDefinitions();
foreach (FailureDefinitionAccessor failure in failuresList)
{
if (failure.GetSeverity() == FailureSeverity.Warning)
writer.WriteLine(failure.GetDescriptionText());
}
writer.Close();
}
}
catch
{
}
}