How to move entity in local axis

hi . I have a instance component in scene that orbited a little in Z axis i want to know how can i move this component along his local X axis ?

Create a translational transformation and apply it to the instance using #transform! or #move!.

1 Like

tanks @DanRathbun its move true

model = Sketchup.active_model
sel = model.selection[0]
axe = sel.transformation.xaxis
tr = Geom::Transformation.translation(axe)

sel.transform! tr

but how can i move it 50 unit along x axis for example

point = [50, 0, 0]
tr = Geom::Transformation.new point
sel.transform! tr

the point can be anywhere.

1 Like

Please Read:
[How to] Post correctly formatted and colorized code on the forum?

model = Sketchup.active_model
sel = model.selection[0]
tr = Geom::Transformation.translation([50,0,0])

sel.transform!(tr)

There is also a trick that the #transform! methods take objects that can be coerced into a transformation, like an array with 3 numeric elements. Ie …

sel.transform!([50,0,0])
2 Likes