How to access bounds corner in rotated object?

hi . for retrieve bounds corner in rotated group or component I’ve faced a problem.
make a group or component and rotate example 30 degrees and try this:

entity = Sketchup.active_model.active_entities
sele = Sketchup.active_model.selection[0]
corner = sele.bounds.corner 1
entity.add_cpoint corner

its ok when object axis & worlds axis match together but when its rotated make mistake
how can i access this corner when object rotate??

Same as before. move it to world axes find the corner, return it back. Also, you can move the corner point.

The blue bounding box shown in Sketchup is the bounds in the component definition. Assuming your component is on the top level you can retrieve the corner by:

entity = Sketchup.active_model.active_entities
sele = Sketchup.active_model.selection[0]
bb = sele.definition.bounds
tr = sele.transformation
corner = bb.corner(1).transform(tr)
entity.add_cpoint corner