diff --git a/lib/from_openstudio/material/window_glazing.rb b/lib/from_openstudio/material/window_glazing.rb index b1e8658..13b741e 100644 --- a/lib/from_openstudio/material/window_glazing.rb +++ b/lib/from_openstudio/material/window_glazing.rb @@ -45,7 +45,12 @@ def self.from_material(material) hash[:display_name] = (material.displayName.get).force_encoding("UTF-8") end hash[:thickness] = material.thickness - hash[:solar_transmittance] = material.solarTransmittance + # check for the transmittance in begin/rescue in case spectral data is not set + begin + hash[:solar_transmittance] = material.solarTransmittance + rescue + return nil + end # check if boost optional object is empty unless material.frontSideSolarReflectanceatNormalIncidence.empty? hash[:solar_reflectance] = material.frontSideSolarReflectanceatNormalIncidence.get diff --git a/lib/from_openstudio/model.rb b/lib/from_openstudio/model.rb index b27d4a7..3504b1e 100644 --- a/lib/from_openstudio/model.rb +++ b/lib/from_openstudio/model.rb @@ -194,7 +194,10 @@ def self.materials_from_model(openstudio_model) end # Create HB EnergyWindowMaterialGlazing from OpenStudio Material openstudio_model.getStandardGlazings.each do |material| - result << EnergyWindowMaterialGlazing.from_material(material) + mat_hash = EnergyWindowMaterialGlazing.from_material(material) + unless mat_hash.nil? + result << mat_hash + end end # Create HB EnergyWindowMaterialBlind from OpenStudio Material openstudio_model.getBlinds.each do |material|