Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

GeometryInstance is not getting transformed.

andergassenM
Contributor

GeometryInstance is not getting transformed.

andergassenM
Contributor
Contributor

Hello,

 

 

 

GeometryElement geometry = element.get_Geometry(neOptions());

BoundingBoxXYZ bbWithoutTransform = geometry.GetBoundingBox();
BoundingBoxXYZ bbWithTransform = geometry.GetBoundingBox(transform);

 

 

 

 

In the code snipped, if the element is just a Family or anything else all good and both bounding boxes are correct.

But when the element is a family that contains sub families, the second bounding box (bbWithTransform) is wrong.

By testing I figured out, that the transformation is only applied to the solids of the geometry (GeometryElement) but not on the GeometryInstance that is also inside the geometry (GeometryElement).

Here is an example.

andergassenM_2-1726820854866.png

 

andergassenM_1-1726820842158.png

 

Both picture show the Boundingboxes of the same Family (Family with SubFamilies) except the second one has differente coordinates in the project.

 

Note: The Transformation is to the origin. (0,0,0) of the world coordinates.   

 

Is this intended or is this a bug?

Edit: I'm using Revit 2024.2

0 Likes
Reply
Accepted solutions (1)
216 Views
1 Reply
Reply (1)

longt61
Advocate
Advocate
Accepted solution

I think you might need to dig a little deeper than that to fully understand how Revit work.

 

1. Family and sub family:

They are called Family and nested family. Basically, you can nest as many families as you like, and as deep as you like. Besides, you need to distinguish a family from a family instance. A family can either be a builtin one or a loadable one, which can be save to a .rfa file. A family instance is a model, a solid, an annotation ... you create once you have loaded a family into your current revit project. 

 

2. BoundingBox and transformation:

Each Revit element has it own transformation, which is how it is rotated, moved ... relatively to the origin point.

A family instance has an extra transformation in the family document, which is how it is rotated, moved ... relatively to the insertion point of the family. By default, the insertion point is at the origin (0,0,0) of the family, or you can change it by create 2 reference planes and set the "Defines Origin" property, to make the intersection point of these 2 planes the origin.

Therefore, once you place a family instance, you have to transform it twice, one for the revit project and one for its family. If you have nested family, the nested family instance will have an other transformation of its own family, thus, you have to transform three times.

Most of the time, the family are properly designed and the insertion point matches the origin point of the family, so you can ignore the family transformation. Other time, especially annotation family, the insertion point can be intentionally transformed from the family origin to meet some requirements.

 

3. How to solve your problem?

Depending on what you are trying to do, you can create a recursive method to get all geometries and nested geometries, then transform them accordingly. Besides, you can install Revit lookup to see how your family instance geometry is structured, nested, ...

0 Likes