Is Group.definition.entities the same as Group.entities?

Is Group.definition.entities the same as Group.entities ?
Are they kept in sync or are they different ? (didnt had time to test)
Thanks!

Yes, they are the same. Group.entities is just a convenience alias for Group.definition.entities.

1 Like

thanks

well, it would be nice to kill Group.entities in the future. This way you have a clear image of the data model.I guess its hard to do it because of backwards compat.

I think it wasn’t always so, but for a while now Group has been implemented as a special case of Component, with some convenience methods such as this and traps to assure uniqueness on edit.

Why doesn’t SketchUp return the same object?

grp = Sketchup.active_model.selection[0]
p grp.entities
p grp.definition.entities

#<Sketchup::Entities:0x000000214285d0>
#<Sketchup::Entities:0x0000002163df28>


can you print the entities for both ? what do they list

That’s strange. The API must create an alias reference to the same actual collection. If you examine the contents they are identical, down to the objects contained.

ah ok, then that’s the reason for different ptrs

Try

p grp.entities.to_a.join("\n")
p grp.definition.to_a.join("\n")