Hello everyone,

I’m making a tool to put an element beside another, like image below:

Step 1:

Step 2:

Ok, everything works like a charm.

But when the component is rotated:

Both components remain like they had not been rotated.

What could be done?

I’m trying to do things with radian, sin and cos, but without success.

The steps are:

1 - Click on the element that will move

2 - Click on another component that will be the reference for the first one

3 - The first component moves to the side of the second.

Some code:

```
# @first = first element selected
# @f_origin = @first.transformation.origin
# same with @second and @s_*
vector = Geom::Vector3d.new [0, 0, 1]
rotation = Geom::Transformation.rotation @f_origin, vector, @s_rotz.degrees
trans = Geom::Transformation.translation [(@s_origin.x - @f_origin.x) - @f_lenx, @s_origin.y - @f_origin.y, 0]
@first.transform! trans * rotation
```

I’m trying now, something like this:

```
degree = @s_rotz
radian = degree * Math::PI / 180
amb_x = Math.cos(radian) * -@s_lenx
amb_y = Math.sin(radian) * @s_lenx
amb_z = 0
new_location = @s_origin + [ amb_x, amb_y, amb_z ]
axes_rotation = Geom::Transformation.axes new_location, @second.transformation.xaxis, @second.transformation.yaxis, @second.transformation.zaxis
@first.transform! axes_rotation
```

The rotation is ok, but the component moves to away from second component.

Thanks folks.