When I used this code-
m=Sketchup.active_model;m.start_operation("ReN");m.definitions.each{|d|next unless d.group?;d.instances.each{|g|g.name=d.instances[0].definition.name if g.name.empty?}};m.commit_operation
I got this error-
Error: #<NoMethodError: undefined method `definition' for #Sketchup::Group:0x834ce04>
removing the .definition removed the error but did not result in the naming of the groups.
removing the .instances[0] seemed to work as expected. The final code string was
m=Sketchup.active_model;m.start_operation("ReN");m.definitions.each{|d|next unless d.group?;d.instances.each{|g|g.name=d.name if g.name.empty?}};m.commit_operation
As an alternative, selecting the offending group will make it easier to find.
m=Sketchup.active_model;s=m.selection;m.start_operation("sel grp");s.clear;m.definitions.each{|d| next unless d.group?;if d.name == "Group#94";d.entities.each{|e| s.add e};end;};m.commit_operation