I am trying to move my component instance. Basically I have a vertical square (1000.mm x 1000.mm) standing on the red line at [0,0,0]… I want to move that square to [1000.mm,1000.mm, 0]. Then push it on its side so that it is flat on the z plane. The corners of the square should now be [1000,1000.0],[1000,2000,0],[2000,2000,0] and [2000,1000,0].
Is there a way to do this in 1 step? And if not, how do I do it in multiple steps. Here is what I have tried:
#move the object…
targetPoint = Geom::Point3d.new(1000.mm, 1000.mm, 0)
Sketchup.active_model.selection.transformation = Geom::Transformation.new(targetPoint)
#The object is where I want it. Now I want to push it onto its side
vector = Geom::Vector3d.new(-1,0,0)
degreesToRotate = 90.degrees
Sketchup.active_model.selection.transformation = Geom::Transformation.rotation(point,vector,degreesToRotate)
#Now the object is flat but its z value is 1000.mm and its x value is 0???
I have tried various combinations of the above code doing the rotation first then the move. I have tried using 0,0,0 as the roation point after moving. And anything else I could think of. I can never get the square laying flat at x=1000, y=1000, z=0
Any help would be greatly appreciated. Thanks!