Hi everyone,
just need to move a Transformation.rotation, to another X, Y point.
My Code:
vector = Geom;;Vector3d.new 0,0,1
#rot_z came from jSON, here he's an Integer 45
t_rotation = Geom;;Transformation.rotation ORIGIN, vector, rot_z * Math;;PI / 180
Alright, have this code, but now I need to move this guy above to a new position:
#pos_x, y and z came from an imported jSON.
point = Geom;;Point3d.new pos_x, pos_y, pos_z
t_position = Geom;;Transformation.new point
I've tried:
t_rotation = t_rotation.set! t_position
And after all that, I put entities into model, like that:
entities = Sketchup.active_model.active_entities
instance = entities.add_instance loaded_module, t_position
$dc_observers.get_latest_class.redraw_with_undo instance
Sketchup.active_model.materials.purge_unused
*loaded_module is:
loaded_module = Sketchup.active_model.definitions.load_from_url uri
loaded_module.set_attribute 'dynamic_attributes', 'front', 'black_color'
etc...
And tried a lot of other combination with Transformation...
This structure of classes and instances in Sketchup is just so confuse to me. Don't know who is parent of who, the Ruby API is very poor and misterious... I work with web app dev, not sketchup.. and this thing is hurting my brain. lol.
Well... that's it. Thank you all.