Sketchup Transformation

How can I control the corner places in boundingbox if it’s displacing from it’s correct position??
for example corner(0) value is at corner(2) and corner(1) is at corner(0) after transformation…

Be more descriptive. Perhaps post images of what you are trying to do.

There can be some confusion with the corners:

  • There are both outer and inner ( or local) bounding boxes;
  • The methods can differ between Groups and ComponentInstances.
  • The developer needs to determine if the associated transformation needs to be applied, not be applied, or its inverse applied.

The outer can be determined with the Drawingelement class’s “bounds” method:
entity.bounds http://ruby.sketchup.com/Sketchup/Drawingelement.html#bounds-instance_method

The local bounding box varies on the type of object:

  1. Sketchup::Group: The Group class’s Inner Bounding Box has a “local_bounds” method:
    http://ruby.sketchup.com/Sketchup/Group.html#local_bounds-instance_method
    Example: entity.local_bounds

  2. Sketchup::Group: Sketchup::ComponentInstance: The Component Instance Inner or local Bounding Box requires its “definition.bounds” method:
    Example entity.definition.bounds
    http://ruby.sketchup.com/Sketchup/ComponentDefinition.html

NOTE: The API description for Sketchup::ComponentDefinition says that it inherit’s the bounds method from Drawingelement. That’s not what my testing shows. It is overriding it and is local.

Sketchup::Group objects also have definitions, and from what I can recall, “definition.bounds” provides another local box.

Sketchup’s select tool appears to select and outline the inner box.

Make sure you are using the desired bounding box, outer or inner/local.
The outer Bounding Box is already in outer coordinates and doesn’t usually need a transformation.
The inner Bounding Box’s corner positions need to have the associated transformation(s) applied to them to make them outer.