Transforming an object with SketchUp Ruby
-
I am struggling a bit with Ruby and would really appreciate some help...
I just want to add some 3D text to my model (which I can do)
model = Sketchup.active_model entities = model.entities mytext = entities.add_3d_text('test', TextAlignCenter, "Arial", true, false, 2.0, 0.0, 0.0, true, 0)
I then want to rotate the text about the z-axis with a transformation, such as
tr1 = Geom::Transformation.rotation(ORIGIN, Z_AXIS, 45.degrees)
I then want to translate the text with a transformation, such as
tr2 = Geom::Transformation.translation Geom::Vector3d.new (0,1,0)
I just cannot work out how to apply tr1, then tr2 to mytext. It's got to be simple, but everything I have tried produces an error.
Thanks in advance from Wales
Kevin -
You need a reference to the object (of the text). Therefore it is usefule to create the text (edges and faces) inside a group and apply the transformations to the group.
entities = model.entities group = entities.add_group group.entities.add_3d_text("test") group.transform!(tr1) group.transform!(tr2)
-
Aerilius
You are a star !
Thanks a million
Kevin
Advertisement