[BUG] ExportImage breaks the in-memory model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The OpenDocumentFile() method in the Autodesk.Revit.ApplicationServices.Application class is documented as follows:
"This method opens the document into memory but does not make it visible to the user in any way."
However, I've identified a scenario where this behavior is broken, causing the document to become visible to the user, like the behavior of OpenAndActivateDocument().
Steps to Reproduce:
Use the OpenDocumentFile() method to open a document in memory.
Call the ExportImage() method to export an image of a view.
Observe the behavior under the following conditions:
If the view type being exported matches the currently active view type (e.g., both are 3D views), the document remains invisible to the user.
If the view type being exported does not match the currently active view type (e.g., a ViewPlan is active, and a 3D view is being exported), the document becomes visible to the user.
Sample code reproducing the issue is attached
Impact:
This behavior disrupts the expected CodeFlow, as the document visibility is changed unintentionally. This issue is particularly critical for one application with over 100,000 users, as it can lead to inconsistent user experiences and potential workflow interruptions.
Affected Revit versions:
2022-2025, Preview