Add entity to a group
-
Hi all
Is there a way to add an existing entity to a new group created by a script ?
I haven't found anything that sounds like "new_group.add_entity(old_entity))...
Thanks in advance, -
entities.add_group(old_entity)
-
Hi Didier !
Perhaps create a group with existing group and entity to add, and explode the existing group inside the new...
Tu pourrais créer un nouveau groupe avec le groupe existant et l'entité à ajouter, puis exploser l'ancien groupe ?
Le problème est si tu veux à tout prix garder le groupe existant (genre si tu as un nom, etc...)sel.add groupe sel.add entite model.active_entities.add_group sel groupe.explode
-
Be careful, though, as you cannot add existing entities to a nested group. The group will exist in model.entities, and not as a nested group.
model = Sketchup.active_model entities = model.entities group1 = entities.add_group face = group1.entities.add_face(points) #points should be defined, of course #============================================================================ # the following group, while coded to be a nested group, will not be nested #============================================================================ group2 = group1.entities.add_group(face)
Google is aware of the situation, but I doubt we'll see a fix before v8.
-
What's the problem if you create a new group with existing group and the entity to add, and AFTER you exploding the existing group inside the new group ??? All entities of the exploded group are in the new group, with the entity to add !
You don't agree ? -
Hi,
Thanks all,Sketchup.active_model.entities.add_group(old_entity) works
Sketchup.active_model.entities.add_group(Sketchup.active_model.selection) also works !
Sketchup.active_model.entities.add_group([entity1,entity2,...,entityN]) works too.Could be put in the Wiki, because this is not mentionned in the regular doc.
-
Ah ok... I have not read the question enough...
I understood : "Is there a way to add an existing entity to a existing group created by a script ?"Hum hum
-
@didier bur said:
Hi,
Thanks all,Sketchup.active_model.entities.add_group(old_entity) works
Sketchup.active_model.entities.add_group(Sketchup.active_model.selection) also works !
Sketchup.active_model.entities.add_group([entity1,entity2,...,entityN]) works too.Could be put in the Wiki, because this is not mentionned in the regular doc.
The most recent documentation has been updated. See below for a link.
-
@unknownuser said:
The most recent documentation has been updated
Oops, apparently the problem for me isn't to know if an information exists, but to know where it is... -
This is the documentation page I use - it's the most up-to-date:
Todd and Rick get all the credit for updating the docs - it's a thankless chore, no doubt.
I wish there was a way to see what changes have been made to the documentation. I've asked that document updates be logged for us, but maybe I'm asking too much.
Advertisement