I have the method here http://teocomi.com/export-revit-warnings-list-from-api/ and am calling it from an application macro method to export warnings for a folder of rvt files:
public async void ExportWarningHTML()
{
Autodesk.Revit.UI.UIApplication uiapp = this;
Document doc = uiapp.ActiveUIDocument.Document;
// Input Directory
string inputDir = @"C:\input";
// Output Directory
string outputDir = @"C:\output";
//Get files from inputDir
string[] files = Directory.GetFiles(inputDir, "*.rvt");
// Set open options to detach from central and preserve ws
OpenOptions openOptions = new OpenOptions();
openOptions.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets;
// Process each *.rvt file in folder
// Naive approach. DOES NOT WORK.
foreach(string file in files)
{
// Get current doc
var docLast = uiapp.ActiveUIDocument.Document;
// Open new document
var docNext = ActiveUIDocument.Application.OpenAndActivateDocument(file);
// Close last document
docLast.Close(false);
// Export Warnings
var html = await Win32Api.ExportWarinings(uiapp, outputDir);
}
}
}
However this only works for the first file then crashes. How can I modify this code or the linked "ExportWarnings" code I linked to to have this process a folder of .rvt files.