get_BoundingBox(null) includes also Symbolic Lines

get_BoundingBox(null) includes also Symbolic Lines

Anonymous
Not applicable
3,689 Views
4 Replies
Message 1 of 5

get_BoundingBox(null) includes also Symbolic Lines

Anonymous
Not applicable

Hi,

I am somehow confused. I have a Family (Electrical Equipment) which have on reference plane drawn some Symbolic lines (door swing). According to description in API documentation I would expect that get_BoundingBox(null) should return a model related Bouding box -- without view related elements. Actually returned bouding box from "element.get_BoundingBox(null)" includes also symbolic lines visible only in floor plan.

 

I checked also with Dynamo (see attached image). Family of the left selected element doen't have symbolic line on reference plane (door swing) and the right one element if of family which have it. I would expect that width of both bounding boxes would be the same.

 

How can I get BoundingBox of actual element geometry -- without symbolic lines?

 

0 Likes
Accepted solutions (1)
3,690 Views
4 Replies
Replies (4)
Message 2 of 5

RPTHOMAS108
Mentor
Mentor
Accepted solution

Symbolic lines are not strictly detail lines since they are not view specific i.e. they appear in multiple parallel views. So I can understand why they may influence the bounding box. Bounding box is also affected by things such as flip controls. To better understand what is happening you can see what is in the bounding box by looking at Element.Geometry property or by using the lookup tool.

 

Wound caution against using bounding box to size things other than FamilySymbol geometry since the cube size is always parallel to the internal co-ordinate axis, so as instance is rotated away from parallel to the internal axis the bounding box limits increase from the minimum that fits the rectangle you may be expecting the bounding box to describe.

 

Would instead read parameters that drive the geometry.

Message 3 of 5

Anonymous
Not applicable

Thanks for explanation. In a mid time I found out how to handle with element.Geometry. I actually need geometric centre of real element bounding box and thought that there is an easy way with Element.GetBoundingBox. Now I am calculating it from bounding boxes of all solids (as returned by element.Geometry... and getting the proper result. Just curious -- is there any easier way?

0 Likes
Message 4 of 5

RPTHOMAS108
Mentor
Mentor

The solid class has a .ComputeCentroid method and a volume property. So getting the geometric centroid of the combined set of solids should be easy to work out based on taking moments about arbitrary axis i.e.

 

Xbar = (PartVolume1 x X1) + (PartVolume2 x X2) +... / Total Volume

 

(similarly for Y and Z).

(Geometric not gravitational).

 

You have to read the caveats in the RevitAPI.chm file:

 

"Calculates the centroid of the solid using an approximation, with an accuracy suitable for architectural purposes. This will correspond only with the center of gravity if the solid represents a homogeneous structure of a single material. "

 

I don't know what they mean by "suitable for architectural purposes", I'm assuming they mean Architect's don't require a great deal of accuracy compared to an Engineer. If however all your shapes are regular then it'll probably be accurate enough. Not used it myself however so I can't certify it's accuracy or reliability.

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks for suggestion. I actually need geometric center of element extents and not its center of gravity, so iterating and making union of separate bounding boxes of each solid is the way to go if there is no comparable API function.

0 Likes