Message 1 of 5
Exception Message: Switching active documents is not allowed during API event handling.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Exception Message: Switching active documents is not allowed during API event handling.
foreach (var filePath in filePaths)
{
try
{
UIDocument uiDocument = uiApp.OpenAndActivateDocument(filePath);
Document currentDoc = uiApp.ActiveUIDocument.Document;
if (previousDoc != null && previousDoc.IsValidObject)
{
// previousDoc.Close(false);
previousDoc = null;
}
RunExportProcess(currentDoc);
previousDoc = currentDoc;
}
catch (Exception ex)
{
MessageBox.Show(ex + "");
LogException(ex, $"Error processing file {filePath}");
}
}
Here How can load multiple revit models in revit?
Developer Advocacy and Support +