Entities.add_group causes Bugsplat!

To reiterate…
If what is to be added into the new group is NOT already in the model.active_entities, then use
group = some_entities.add_group()
then use add entities to group.entities afterwards…

If the entity or entities are in the active_entities context then you can use:
group = some_active_entities.add_group(some_active_entity)
or
group = some_active_entities.add_group(model.selection.to_a)
or
group = some_active_entities.add_group(an_array_of_some_active_entities)
etc

Obviously, you can’t add an entity from one context directly into another [a BugSlat awaits!] - however, if the entity is a group or component_instance, then you can get the definition of that and use add_instance(), copying the original’s transformation, making allowances for the context’s transformation etc.
Similarly you could ‘clone’ faces and edges etc - but not easily…
If you merely want to copy it, then there will be two instances [for a group you might want to consider using make_unique]
If you want to move it from one context to another, then after the add_instance() you will need to use .erase! on the original item…

3 Likes