Hello,
I have written a user script to remove unused thermal zones (they remain after deleting the space). Before deleting the thermal zone, I delete the zone equipment. It works fine with every thing except with AirTerminal type equipment. If there is an AirTerminal in the zone equipment Sketchup or Openstudio will crash after removing. This is my code:
def removeUnusedThermalZones(model) thermal_zones = model.getThermalZones
thermal_zone_handles_to_remove = OpenStudio::UUIDVector.new
equipmentListToRemove = []
thermal_zones.each do |thermal_zone|
if thermal_zone.spaces.empty? && thermal_zone.isRemovable
thermal_zone_handles_to_remove << thermal_zone.handle
if not thermal_zone.equipment.empty?
thermal_zone.equipment.each do |equip|
equipmentListToRemove<< equip
end
end
end
end
if not equipmentListToRemove .empty? equipmentListToRemove .each {|equip| equip.remove } end
if not thermal_zone_handles_to_remove.empty?
model.removeObjects(thermal_zone_handles_to_remove)
puts "Eliminando #{thermal_zone_handles_to_remove.size} thermal zones."
else
puts "No unused thermal zones to remove."
end
end