entityID doesn't update in a group copy


When I group some elements for instance a Face and 4 edges, I have some entityID for the elements inside.
My problem is when I copy this group , the entities inside the new group have the same entityID.

I have found a solution with the GUI if I enter the group, then entityID are changed/updated.
But I’m looking for a pure Ruby solution as I want to make my script fully work by its self.

The persistent_id and the inspect are updated too.
Check this example :

ss = Sketchup.active_model.selection
#select group 1
puts ss[0].entities[0].entityID, ss[0].entities[0].persistent_id , ss[0].entities[0]


#make a copy of group 1 and select it
puts ss[0].entities[0].entityID, ss[0].entities[0].persistent_id , ss[0].entities[0]


I use Sketchup make 2017

Is it a bug or is it the way it suppose to work?
Do you a solution for me ?

Thanks !

Just a quick tip before I go to bed:
Try to use:
The Group #make_unique method…

“Copying a group in SketchUp will create a group that shares the same definition. SketchUp implicitly makes group unique when edited from the GUI, and from a user point of view groups could be thought of as always being unique. To honor this behavior, call this method before editing a group through the API.”
. :sleeping:


… and for IDs that persist across sessions, favor the Entity#persistent_id method.


I thought this method was only for Component !
Amazing ! Thank you.

1 Like

Yea! The groups are a kind of special component in SU.
Among other similar/same methods, it is the most “revealing”:
The Group #definition method is used to retrieve the component definition for this group.
(Returns : (Sketchup::ComponentDefinition) ) :wink:

( Edit
After making it unique, beside the above mentioned id’s even its definition get its own unique definition name: Group#1 , Group#2…etc)