public static BHX.Glaze ToGBXGlazed(this BHC.Layer layer) { if (layer == null || layer.Material == null) { return(null); } SolidMaterial transparentProperties = layer.FindMaterial <SolidMaterial>(typeof(SolidMaterial)); if (transparentProperties == null) { return(null); } BHX.Glaze glaze = new BHX.Glaze(); glaze.ID = "glaze-" + layer.Material.Name.Replace(" ", "-").Replace(",", "") + layer.Material.BHoM_Guid.ToString().Substring(0, 5); glaze.Name = layer.Material.Name; glaze.Thickness.Value = Math.Round(layer.Thickness, 4).ToString(); glaze.Conductivity.Value = transparentProperties.Conductivity.ToString(); glaze.SolarTransmittance = new BHX.Transmittance { Value = Math.Round(transparentProperties.SolarTransmittance, 3).ToString(), Type = "Solar" }; List <BHX.Reflectance> solarReflectance = new List <BHX.Reflectance>(); solarReflectance.Add(new BHX.Reflectance { Value = Math.Round(transparentProperties.SolarReflectanceExternal, 3).ToString(), Type = "ExtSolar" }); solarReflectance.Add(new BHX.Reflectance { Value = Math.Round(transparentProperties.SolarReflectanceInternal, 3).ToString(), Type = "IntSolar" }); glaze.SolarReflectance = solarReflectance.ToArray(); glaze.LightTransmittance = new BHX.Transmittance { Value = Math.Round(transparentProperties.LightTransmittance, 3).ToString(), Type = "Visible" }; List <BHX.Reflectance> lightReflectance = new List <BHX.Reflectance>(); lightReflectance.Add(new BHX.Reflectance { Value = Math.Round(transparentProperties.LightReflectanceExternal, 3).ToString(), Type = "ExtVisible" }); lightReflectance.Add(new BHX.Reflectance { Value = Math.Round(transparentProperties.LightReflectanceInternal, 3).ToString(), Type = "IntVisible" }); glaze.LightReflectance = lightReflectance.ToArray(); List <BHX.Emittance> emittance = new List <BHX.Emittance>(); emittance.Add(new BHX.Emittance { Value = Math.Round(transparentProperties.EmissivityExternal, 3).ToString(), Type = "ExtIR" }); emittance.Add(new BHX.Emittance { Value = Math.Round(transparentProperties.EmissivityInternal, 3).ToString(), Type = "IntIR" }); glaze.Emittance = emittance.ToArray(); return(glaze); }
public static BHX.Gap ToGBXGap(this BHC.Layer layer) { if (layer == null || layer.Material == null) { return(null); } GasMaterial gasProperties = layer.FindMaterial <GasMaterial>(typeof(GasMaterial)); if (gasProperties == null) { return(null); } BHX.Gap gap = new BHX.Gap(); gap.ID = "gap-" + layer.Material.Name.Replace(" ", "-").Replace(",", "") + layer.Material.BHoM_Guid.ToString().Substring(0, 5); gap.Name = layer.Material.Name; gap.Thickness.Value = Math.Round(layer.Thickness, 4).ToString(); gap.Conductivity.Value = Math.Round(gasProperties.Conductivity, 3).ToString(); switch (gasProperties.Gas) { case Gas.Air: gap.Gas = "Air"; break; case Gas.Argon: gap.Gas = "Argon"; break; case Gas.Krypton: gap.Gas = "Krypton"; break; default: gap.Gas = "Custom"; break; } return(gap); }