Seems related to this post about mapping space names to plan for the purpose of re-naming, but not exactly the same question.
There is a user script in the SketchUp Plugin called Rename ThermalZones Based on Space Names. this also exists as a measure for use outside of app, along with another measure to Rename Space Surfaces Based on Parent Space and Orientation
The user script in the SketchUp plugin has code that does thermal_zones.each do
where thermal_zone = model.getThermalZones
. You could change that to model.getSpaceTypes.each do |space_type|
and then loop through spaces with space_type.spaces.each do |space|
. Then you could use any logic you want to rename the individual spaces.
You can get an objects name with object.name
in some cases you may need to use object.name.to_s
. Then to set the name of the object use object.setName("My New Space Name")
.
I would recommend using a measure vs. just a SketchUp user script, but either will work.