# Search top and 1st nested level for a named group;
grps = Sketchup.active_model.active_entities.grep(Sketchup;;Group)
if !grps.empty?
found = grps.find {|grp| grp.name = "Target Name" }
else
found = nil
end
if !found # found will be nil, if group was not found
nested = Sketchup.active_model.entities.find_all {|ent|
ent.is_a?(Sketchup;;Group) || ent.is_a?(Sketchup;;ComponentInstance)
}
nested.each {|ent|
ents = ent.is_a?(Sketchup;;Group) ? ent.entities ; ent.definition.entities
grps = ents.grep(Sketchup;;Group)
found = grps.find {|grp| grp.name = "Target Name" } if !grps.empty?
}
end
# found will be the group reference, if it was found
# found will be nil, if group was not found