Need Help with Symmetrically Duplicating Objects in SketchUp Using Ruby

I have a requirement: symmetric duplication (note, not mirroring) of an object. For example, object A is on the left side of the X-axis, 100 cm from the world origin, and has rotated 30 degrees clockwise around its blue axis. Now, I want to duplicate object A (as object B), placing it on the right side of the X-axis, also 100 cm from the world origin, but object B is rotated 30 degrees counterclockwise around its blue axis. Regarding the rotation on the red axis and the green axis, maintain the rotation parameters of object A. How can I implement this in the Ruby language? Just like the attachment I uploaded, please note the corresponding positions of the colors.

You will need to use:

… passing in the definition reference of instance A and a new transformation possibly a result of the modified from instance A’s transformation.

If you know where to place it relative to the origin of the model then you can just create a translational transform == [100.cm, 0, 0] and then transform it using a rotational transform about an [0,0,1] vector located at the center point of the object’s bounds.

Another paradigm might be to just place a new instance directly in the footprint of instance A and then transform the instance B to reposition it relative to that position if known.

Look at the code snippet, in the API docs for the Sketchup::ComponentInstance#transform! method.

In your case you’d get the definition reference from a call to instance_A.definition