How to use arbitrary points for transforming?

how we can use arbitrary points of model for move object to some where?
for example in the sketchup scene we have 2 box component , for make side by side i click some first box corners and set it in second box corner (so i didn’t use origin for it)
how we can simulate this action by code?

Hamed, you need to move and rotate. If you know both well you move and rotate well. Also, you can think about some more simple solutions. For example, if I want solve your problem for two similar boxes, I transfer both to the word’s coordinate, move one of them to the side of the other one, then move back both. For rotation, you need to know angel, direction, rotate a center point, and lots of practices. Please let me know which one do you need to know.

1 Like
pt = cube1.bounds.corner(1)
vec = cube2.transformation.origin.vector_to(pt)
cube2.transform!(Geom::Transformation.translation(vec))

REF:

… and …

1 Like

tanks @majid866 , regardless of rotation my intention was special relative moving that
i couldn’t explain it well but @DanRathbun got it, the missing link was “vector_to”

2 Likes