Curtain wall `Element Bounding Geometry` outcome not as expected

Recently, I encountered the same issue.

When I examined the source code on GitHub, I noticed that the top curve is translated using the following line:

side1TopCurve.Translate(0, 0, fromPoint.Z + height);

However, since fromPoint.Z already includes the base elevation and side1TopCurve starts at that same elevation, this line adds extra elevation to a curve that’s already correctly positioned at the base. As a result, the bounding Brep becomes too tall and extends beyond the actual top of the wall in Revit.

Suggestion to Improve the Code

Translate the duplicated top curve only by the wall height, not by fromPoint.Z + height:

side1TopCurve.Translate(0, 0, height);

This ensures that the top curve moves correctly from the base elevation (already applied earlier) to the intended top elevation of the wall.

GitHub Source