Wrong calculation about Quantities.Bounding box length/width
-
Hi Solibrians,
I just encountered a bug about Quantities.Bounding box calculations
The property is shown 856mm as bounding box width and 2.096mm as bounding box length

But I used API getBoundingBox().getSizeY() and the code returned 0.876999 as value.
API getBoundingBox().getSizeX() and the code returned 2.082 as value.


Let me know if you need the model to investigate.
Thanks -
Hi @HieuVH-FPT,
Component.getBoundingBox() gives you an axis-aligned bounding box. This might be different from the Quantities Bounding Box, which is the “tight”, non axis-aligned bounding box of the component. You can still access these through the API using Component.getBoundingBoxWidth() and getBoundingBoxLength(). These should calculate the same Width and Length in the Quantities tab.
Hope this helps
-
Hi @phuc-nguyen
Isn’t non axis-aligned bounding box of the component same as Rectangle2d object?
I have the Rectangle2d of the component

API getLongerSegmentLength() and getShorterSegmentLength() don’t return values same as properties


So Component.getBoundingBoxWidth() and getBoundingBoxLength() are not related to any geometry APIs? -
Yes, Component.getBoundingBoxWidth() and getBoundingBoxLength() are not implemented by the Geometry API, but by internal Solibri library. (Legacy reasons)
Just to confirm about the Rectangle2d case, I notice that the numbers you show from getLongerRectangleSegmentLength() and getShorterRectangleSegmentLength() are equal (floating) to those from getBoundingBox().getSizeX() and Y(). I’m unclear about which Rectangle2d is being used, axis-aligned or footprint minimum bounding rectangle. Was it component.getFootprint().getArea().getMinimumBoundingRectangle()?
-
@phuc-nguyen yes, it is component.getFootprint().getArea().getMinimumBoundingRectangle()
Even if it is axis-aligned like getBoundingBox().getSizeX() and Y(), the values are not equal to Component.getBoundingBoxWidth() and getBoundingBoxLength()
Copyright © 2025 Solibri Inc. | Powered by NodeBB