Because it's working on a user's selection then all of the selected entities are in the active_entities context and you won't run the risk of a BugSplat by making a group from them directly [this is advised against usually but try it].
model=Sketchup.active_model
ents=model.active_entities
ss=model.selection
group=ents.add_group(ss.to_a)
volume=group.volume
group.explode
'volume' is the volume of the selected objects in cu" if the objects don't form a solid then it'll be a negative value...
Assuming that the user should have selected one group to get the volume...
if ss[0] and ss[0].class==Sketchup;;Group
volume=ss[0].volume
if volume==0
UI.messagebox("Warning! The selected group has no volume")
elsif volume<0
UI.messagebox("Warning! The select is not a 'solid' group.")
end#if
else
UI.messagebox("Select ONE group!")
return nil
end#if
there are many ways to achieve what you want π€