Right now I’m using transformation=
to move a ComponentInstance, but this doesn’t move any components that are glued to that object like the Move tool does. I also tried move!
and transform!
. I don’t see any way to get a list of glued objects either (no corresponding method to Face.get_glued_instances
). Is this possible? Hoping for a solution that works with 2017+.
Try something like …
# Where ci is a reference to the component instance:
ents = ci.parent.entities
glued = ents.find_all {|ent|
ent.respond_to?(:glued_to) && ent.glued_to == ci
}
grp = ents.add_group(ci,*glued)
# Where t is a reference to a transformation:
grp.transform!(t)
grp.explode
1 Like
Perfect, thank you! Instead of the group I ended up using ents.transform_entities
, because add_group
was crashing for me, and I could guarantee that ci.parent
would not be in the active path (except the Model).
1 Like
Okay, I was not sure that they’d remain glued if transformed individually.
It turns out that Entities.transform_entities
actually moves glued objects correctly! I never tested that because I assumed it would be the same as transform!
. So I can reduce that code to ci.parent.entities.transform_entities(t, [ci])
.
1 Like
Good to know!
And, you don’t actually need the literal array as a 2nd argument, as the method will also take a list of entities.