Slow performance when get the bounding box per view plane

Slow performance when get the bounding box per view plane

ptranU2KHX
Advocate Advocate
258 Views
2 Replies
Message 1 of 3

Slow performance when get the bounding box per view plane

ptranU2KHX
Advocate
Advocate

Hi everyone,

 

I have been working with many lines of code to figure out what makes my plugin execute slowly in Revit.

It turns out the Element.BoundingBox function is the one I should focus.

ptranU2KHX_0-1685667743101.png

Each time I get the BoundingBox of Wall element, it takes around 100ms per once. The duration time will be a significant issue when a project has so many walls with many view planes. It could take hours to finish the execution.

 

I'd like to ask for any solution to overcome this slow performance. A workaround or any settings in Revit or any suggestions will be much help.

 

Thank you.

259 Views
2 Replies
Replies (2)
Message 2 of 3

TripleM-Dev.net
Advisor
Advisor

Hi @ptranU2KHX,

 

Depends what you further do with the resulting boundingbox, without more context it's hard to say how to optimize it.

Do you need the Box determined from the view (Cut or visible in view could only really affect walls) or would the box from the model without the view argument be enough.

 

If you are checking if a wall is visible in a view, use FilteredElementCollector with the view id argument, this will only return the visible walls in the view, and would be fast.

 

Could the view itself also be "heavy", try a view where only the walls are visible and see if that is faster.

 

- Michel

 

Message 3 of 3

ptranU2KHX
Advocate
Advocate

Hi @TripleM-Dev.net 

Thank you for your response.

I need to specify the view because in the view, I have some limitations on the bounder and I need to get the boundary box of the wall. With the boundary box, I can check if the wall is visible in the view and also meet my limitations.