Let’s assume you have a box named ‘box_123’.
Set a reference to that string, e.g.
gpname='box_123'
To find it [or all if there is more than one with that same name] use something like:
gps = model.active_entities.grep(Sketchup::Group).find_all{|g| g.name==gpname }
Now gps is an array containing nil [if no match], or one or more groups having that name.
Just to see if it works add this:
ss=model.selection
ss.clear
ss.add(gps)
To erase the group[s]
model.active_entities.erase_entities(gps) if gps[0]
Or to erase just one thing at a time - let’s say that it’s referenced as ‘group’:
group.erase!