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


#1

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


#2

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


#3

thanks


#4

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.


#5

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.


#6

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>



#7

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


#8

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.


#9

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


#10

Try

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