[BUG] Hiding not working when exporting images

[BUG] Hiding not working when exporting images

nice3point
Advocate Advocate
436 Views
7 Replies
Message 1 of 8

[BUG] Hiding not working when exporting images

nice3point
Advocate
Advocate

When using the OpenDocumentFile() method to open a document in memory, the ExportImage() method ignores hidden elements. Specifically, methods such as HideCategoriesTemporary(), HideElements(), and HideElementsTemporary() do not have any effect on the visibility of elements during the image export process

 

Steps to Reproduce:

  1. Open a document in memory using the OpenDocumentFile() method.

  2. Use any of the hiding methods (HideCategoriesTemporary(), HideElements(), HideElementsTemporary()) to hide specific elements or categories.

  3. Call the ExportImage() method to export an image of a view.

 

 

Workaround:

 

Interestingly, if the view.Outline property is accessed before calling ExportImage(), the hidden elements are correctly excluded from the exported image. The fact that accessing view.Outline resolves the issue suggests that there may be an internal state or initialization step that is not being triggered correctly when ExportImage() is called directly. view.get_BoundingBox(null); also works in the same way

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

0 Likes
437 Views
7 Replies
Replies (7)
Message 2 of 8

jeremy_tammik
Alumni
Alumni

Dear Roman,

  

Thank you for your report, clear description and sample material.

 

Sorry to hear about this.

 

I logged the issue REVIT-232472 [OpenDocumentFile + ExportImage ignores hidden elements] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

  

If it is especially important and urgent for you, you might also want to mention this ticket number in the preview discussion forum, where you have more access to chat directly with the development team.

 

Best regards,

 

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 8

jeremy_tammik
Alumni
Alumni

The development team requests: Please confirm this works as expected in Revit UI and the problem is API only. Thank you!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 8

nice3point
Advocate
Advocate

@jeremy_tammikconfirm, the problem is related only to the API method OpenDocumentFile, in the UI version everything works properly

0 Likes
Message 5 of 8

nice3point
Advocate
Advocate

REVIT-233525 incudes this fix or not ? @jeremy_tammik 

0 Likes
Message 6 of 8

jeremy_tammik
Alumni
Alumni

No, probably not. Some notes on REVIT-232472 include:

     

I could reproduce this with the customer's code put into a macro. The fact that accessing the view outline or bounding box after the change leads me to wonder if the view is being refreshed by those accessors...

  

I tested this a little bit since I had a test project ready. The observation about the transaction is correct. However, the aim of the code may be a complex behaviour involving a partially committed "Temporary Hide/Isolate" state. "Temporary Hide/Isolate" requires a transaction in the code, but maybe the expectation is not clear, or there is something else going on.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 7 of 8

nice3point
Advocate
Advocate

As I understand from the description, they've confirmed the issue but haven't solved it yet?

 

> The observation about the transaction is correct.

Unfortunately, a commit or something else with the transaction has no effect

0 Likes
Message 8 of 8

jeremy_tammik
Alumni
Alumni

That is my understanding also.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open