Element BoundingBox | Ignore non-visible items

Element BoundingBox | Ignore non-visible items

Anonymous
Not applicable
2,897 Views
5 Replies
Message 1 of 6

Element BoundingBox | Ignore non-visible items

Anonymous
Not applicable

Good day,

 

The last time I was at the API forums I was politely shunted to Dynamo to which I gladly obliged, but now I have returned on a new quest!

 

I would like to know if it is possible to set the bounding box to only take visible geometry into account, as I've explained in the post below:

https://forum.dynamobim.com/t/bounding-box-ignore-hidden-geometry/38428/3

I have referred to the following links:

https://thebuildingcoder.typepad.com/blog/2008/10/element-bounding-box.html

https://www.revitapidocs.com/2020/def2f9f2-b23a-bcea-43a3-e6de41b014c8.htm

 

and saw that Element BoundingBox property retrieves a box that circumscribes all geometry of the element. This holds true for geometry for which the visibility is switched off, as well as for flip controls, etc.

 

Is there a work around for this?

 

It would be ideal if I could use a function to get the bounding box of visible elements only automatically, regardless of the family. The last resort is to utilise Mark Ackerley's approach of setting max-x, -y, and -z parameters for the family (and all other families which I may wish to get the boundary of), and then using these to define the cropbox regions. 

A nudge in the right direction would be highly appreciated - even if its just to hear that its not possible. Thank you!

0 Likes
Accepted solutions (1)
2,898 Views
5 Replies
Replies (5)
Message 2 of 6

thomas
Advocate
Advocate

Before attempting anything, the most salient question to ask is: what's your end goal? What do you intend to do with the bounding boxes? 

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi @thomas

 

My goal is to use the bounding boxes to determine viewport sizes that will be sorted onto sheets by size or type. Then they will pack neatly next to each other filling a row on the x-axis, and then once the row is full, they will continue on a row below or on a new sheet. The space between them is determined by the viewport sizes (currently determined by containing element's bounding box) 

 

So far I can get this:So far I can get this:to do this.to do this.

*Script still needs refinements on spacing and placing

.

The bounding box does quite a good job of this except for taking invisible geometry into account.

 

 

0 Likes
Message 4 of 6

thomas
Advocate
Advocate
Accepted solution

Ok so performance is not so important (e.g. you dont need to use the bb as a quick filter). In that case, you could extract the geometry from the family (using the RevitAPI, not Dynamo nodes), and query any solids for their Visibility (a property in the GeometryObject  class which Solids inherit). You can use this as a filter technique, then redraw a new bounding box around all the solids which are visible (simplest way would be to get all the min/max points and define two new min max points which are the minX/Y/Z and max X/Y/Z coords of the set) to get the result you require. 

0 Likes
Message 5 of 6

Anonymous
Not applicable

That sounds promising - I will give it a shot and follow up! Thank you.

0 Likes
Message 6 of 6

Anonymous
Not applicable

Did it work for you in the end?

0 Likes