SUDrawingElementGetBoundingBox - is the bounds local or world space?


#1

Something I’m not sure about is the bounding box retrieval function for a drawing element; does the function which queries the drawing element’s bounds return the bounds in world or local space?


#2

I don’t develop with the C++ API, but the Ruby one (so you may want to ignore me). In the Ruby API, only Sketchup group and component instances support a “local bounds”. The “Drawing Element” class applies to all things you can draw in the model, and I expect this function call should be providing a non-local bounding box similar to the Ruby API.

You used the term “world space”, which to me means the outer most coordinate system (i.e. Sketchup’s world axes and origin). If the drawing element you are working with is nested inside any grouped object, then its bounding box positions will be relative to that. (I have plugin that allows me to click on drawing elements and evaluate their bounding box, but it is currently “broken”).


#3

It would be in the coordinates of the container of that DrawingElement.
Note that the boundingbox objects in the APIs doesn’t represent the selection box you see in the viewport. The boundingboxes will be aligned according to the model’s original axes (not working axes).