Geom::Transformation
-
I am totaly beginner in Sketchup scripting.
This code move object to some position,
trans = Geom::Transformation.new(bb.center.vector_to([100,0,0])) ; # move the temp bounding box
How is posible to move object just by zaxis and other axis dont affect. -
Your example uses a point
[100,0,0]
to move the object 100 inches along the X_AXIS.
To move it in the Z_AXIS just try[0,0,100]
Also it'll be best to do a simple 'translate' rather than '[re]locate' it ?
trans = Geom::Transformation.translation([0, 0, 100])
A three element array can be substituted for a point or a vector.
If you want units other than inches do it like this
100.mm
-
I have some object with his location, and select it and i want just to move this object to zaxis=0, and leave other axis unchanged.
-
Slightly different question.
If you want to move its center onto the ground-plane [z=0], consider this...### ... bb = some_object.bounds ct = bb.center pt = ct.clone pt.z = 0 ve = ct.vector_to(pt) tr = Geom::Transformation.translation(ve) some_object.transform!(tr)
-
Thanks!
Advertisement