How to set layer to entities in group

layer = Sketchup.active_model.layers.add("win")
entities2 = group.entities
entities2.layer = layer

I can set layer to group
But don’t know how to set layer to entities in the group

entities2 is a collection of all entities inside the group.
So you need to iterate that thus:
entities2.each{|e| e.layer = layer }
However, it’s usually bad practice to assign layers to raw geometry - edges and faces - so it might be better to filter those out before assigning the layer to what’s left ?