Add_group with argument
-
Doing some tests, I realized that
entities.add_group <list_of_entities>
will not really add a new group containing the list of entities.Instead it will make put the entities into a new group, that is, create a new group and move the entities inside.
This is the behavior in SU8, SU13 and SU14.
So, it is in reality equivalent to a "Make Group" function.
Did I miss something?
Fredo
-
@fredo6 said:
Doing some tests, I realized that
entities.add_group <list_of_entities>
will not really add a new group containing the list of entities.Instead it will make put the entities into a new group, that is, create a new group and move the entities inside.
This is the behavior in SU8, SU13 and SU14.
So, it is in reality equivalent to a "Make Group" function.
Did I miss something?
Fredo
Your confusion confuses me
My read of the API is that if e is an Entities collection, g= e.add_group creates a new group g within e. When you provide entities as an argument to the method, it puts them into g.entities. What did you think would happen?
Steve
-
I would have thought that SU would rather 'copy' the entities, not 'move' them.
Fredo
-
Remember too that it splats if the passed entities in add_group() are not in the active_entities context !
Assuming manual selection.
grp = selection[0].parent.entities.add_group(selection.to_a)
Does exactly what would happen if you selected some things and invoked the native 'Make Group'.
If you want to COPY the selected items into a group then use this process:
grp = selection[0].parent.entities.add_group(selection.to_a) grp2 = selection[0].parent.entities.add_instance(grp.entities.parent, grp.transformation) grp.explode grp = grp2 grp2 = nil
Now
grp
refers to the group of selected objects but the 'originals' are still in place... -
TIG,
Thanks. Indeed, once it is clear that this is an equivalent to make_group, I can manage to design a 'copy-as-group'.
Thanks to all
Fredo
Advertisement