There is no need to explode - just don't create two groups.
Change this:
bbx1 = Sketchup.active_model.entities.add_group
g1 = bbx1.entities.add_group
face1 = g1.entities.add_face boxpts
face1.reverse!
face1.pushpull(bbxmax.z-bbxmin.z )
to
bbx1 = Sketchup.active_model.entities.add_group
face1 = bbx1.entities.add_face boxpts
face1.reverse!
face1.pushpull(bbxmax.z-bbxmin.z )
If you read your code carefully you will see that you call add_group twice, once in the root entities element and once in the first group you created.