What is actualy the bounding Box?

Hi all,
Im exhausted trying to figure out what is actually the bounding box. I thought that was the blue box that appears when you select a group or component. In the image i have two copies of the same group, but the A is rotated. When i run the code below i get differents widths. ¿How could i recover the same widths for both groups?

# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection

UI.messagebox("Width_A="+String(sel[0].bounds.width)+"
Width_B="+String(sel[1].bounds.width), type = MB_OK)

This is not the definition of a bounding box.

Review the description of the Geom::BoundingBox class in the API documentation.

BTW … You can use String interpolation for a more concise statement…

msg = "Width_A=#{sel[0].bounds.width} Width_B=#{sel[1].bounds.width}"
UI.messagebox(msg)

See the primer on String literals: File: literals.rdoc [Ruby 2.7.2]

Note: The MB_OK type is the default.


However we usually suggest using a puts statement to output tests to the console because messageboxes can fail silently if the string is malformed.

Right, i rode that definition which talk about axes, but don´t specify if are parent´s axes or the own group axes. That was my error. Thanks a lot

1 Like

Yes it is aligned with the (parent) axes in which the instance is a child.

For an example of getting the points for the actual bounding box you can look at my Draw BoundingBox extension: