Hi
EDIT: just realized some errors in the code, eg. that I forgot to instantiate the component
Now the code snippets should work…
How to change axes inside a component?
Change the axes globally (working):
model = Sketchup.active_model
ents = model.active_entities
defs = model.definitions
my_component = defs.add "my_component"
t = Geom::Transformation.new [0,0,0]
my_component.entities.add_face [[0,0,0], [100,0,0], [100,0,100], [0,0,100]]
my_component_instance = ents.add_instance(my_component, t)
xaxis = Geom::Vector3d.new(3, 5, 0)
yaxis = xaxis * Z_AXIS
model.axes.set([10,0,0], xaxis, yaxis, Z_AXIS) # change axes globally as expected
Trying to change axes inside component (not working):
model = Sketchup.active_model
ents = model.active_entities
defs = model.definitions
my_component = defs.add "my_component"
t = Geom::Transformation.new [0,0,0]
my_component.entities.add_face [[0,0,0], [100,0,0], [100,0,100], [0,0,100]]
my_component_instance = ents.add_instance(my_component, t)
xaxis = Geom::Vector3d.new(3, 5, 0)
yaxis = xaxis * Z_AXIS
my_component_instance.model.axes.set([10,0,0], xaxis, yaxis, Z_AXIS) # why is the axes set globally and not inside the component?
- God bless