Is it possible to get outline of component instead bounds?

Is it possible to get the “outline” of a component instead of a bounding box? I need the points of the corners of my component. In the attached photo, the light blue area is the bounding box for my component. The white area is my component – viewed from above in parallel projection. I need to programmatically get the corner points of the white area. Is this possible without exploding the component and getting the face points? This is a simple example. I could have more complex components where there could be 4 or more corners on the component. I basically want to trace an outline around my component. Thanks for your help. BoundsVsOutline

Given a Ruby reference to the component instance called “entity”, the outer blue bounding box object can be accessed with:

outer_bounds = entity.bounds

The associated corners would be in outer (or in your case perhaps) world coordinates.

The local white bounding box can be accessed with:

definition_bounds = entity.definition.bounds

The associated corners would be in relative or local coordinates, and would need to have the transformation for the specific component instance applied to them to transform them into world coordinates.

Even though this specific example is two dimensional, the bound box corner method accepts 8 different indices, returning 3 dimensional data.

Not exploding! We are programmers, not mouse clickers. You can access any entity and read its properties without making changes to the model or involving user action.

If you have a reference to the component instance called my_component, you can read the entities inside:

# -> [#<Sketchup::Face>, …]

The component has a unique definition that is used everywhere where a copy (instance) of the component is located. The definition has its own, local coordinate system, and you get the face’s point coordinates in the local coordinate system.

When you want to draw the tracing outside of the component, the challenge is that it is a different (probably the global) coordinate system and you have to convert the coordinates by using the component instance’s transformation.