def test_invalid_values(self): trans = Trans('trans_material') # testing for r_reflectance covers the rest as they are all RadianceNumber with pytest.raises(Exception): trans.r_reflectance = 2 with pytest.raises(Exception): trans.r_reflectance = -1
def to_hb(self) -> RadianceProperties: return RadianceProperties( material=Trans(name=self.name, r_reflectance=self.reflectance, g_reflectance=self.reflectance, b_reflectance=self.reflectance, transmitted_diff=self.transmittance, transmitted_spec=self.transmittance))
def test_from_reflected_spacularity(self): trans = Trans.from_reflected_spacularity('trans_material') assert trans.name == 'trans_material' assert trans.r_reflectance == 0 assert trans.g_reflectance == 0 assert trans.b_reflectance == 0 assert trans.specularity == 0 assert trans.roughness == 0 assert trans.transmitted_diff == 0 assert trans.transmitted_spec == 0
def test_from_to_json(self): trans = Trans('trans_material') trans_json = trans.to_json() assert trans_json['name'] == 'trans_material' assert trans_json['r_reflectance'] == 0 assert trans_json['g_reflectance'] == 0 assert trans_json['b_reflectance'] == 0 assert trans_json['specularity'] == 0 assert trans_json['roughness'] == 0 assert trans_json['transmitted_diff'] == 0 assert trans_json['transmitted_spec'] == 0 trans_from_json = Trans.from_json(trans_json) assert trans_from_json.name == 'trans_material' assert trans_from_json.r_reflectance == 0 assert trans_from_json.g_reflectance == 0 assert trans_from_json.b_reflectance == 0 assert trans_from_json.specularity == 0 assert trans_from_json.roughness == 0 assert trans_from_json.transmitted_diff == 0 assert trans_from_json.transmitted_spec == 0
def test_from_string(self): trans_material_str = """void trans PANEL 0 0 7 0.48913 0.48913 0.48913 0.08 0 0.5333 0 """ trans = Trans.from_string(trans_material_str) assert trans.name == 'PANEL' assert trans.r_reflectance == 0.48913 assert trans.g_reflectance == 0.48913 assert trans.b_reflectance == 0.48913 assert trans.specularity == 0.08 assert trans.roughness == 0 assert trans.transmitted_diff == 0.5333 assert trans.transmitted_spec == 0
Returns: material: Radiance trans material """ ghenv.Component.Name = "HoneybeePlus_Radiance Trans Material" ghenv.Component.NickName = 'radTransMat' ghenv.Component.Message = 'VER 0.0.05\nOCT_22_2018' ghenv.Component.Category = "HoneybeePlus" ghenv.Component.SubCategory = '01 :: Daylight :: Materials' ghenv.Component.AdditionalHelpFromDocStrings = "2" try: from honeybee.radiance.material.trans import Trans except ImportError as e: raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) if _name: name = _name r_ref = 0.35 if _r_ref_ is None else _r_ref_ g_ref = 0.35 if _g_ref_ is None else _g_ref_ b_ref = 0.35 if _b_ref_ is None else _b_ref_ ref_spacularity = 0 if _spec_ref_ is None else _spec_ref_ roughness = 0 if _rough_ is None else _rough_ diff_trans = 0.15 if _diff_trans_ is None else _diff_trans_ spec_trans = 0.15 if _spec_trans_ is None else _spec_trans_ modifier = _modifier_ or "void" material = Trans.from_reflected_spacularity(name, r_ref, g_ref, b_ref, ref_spacularity, roughness, diff_trans, spec_trans, modifier)
material: Radiance trans material """ ghenv.Component.Name = "HoneybeePlus_Radiance Trans Material" ghenv.Component.NickName = 'radTransMaterial' ghenv.Component.Message = 'VER 0.0.05\nAUG_14_2018' ghenv.Component.Category = "HoneybeePlus" ghenv.Component.SubCategory = '01 :: Daylight :: Materials' ghenv.Component.AdditionalHelpFromDocStrings = "1" try: from honeybee.radiance.material.trans import Trans except ImportError as e: raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) if _name: name = _name r_reflectance = 0 if _r_reflectance_ is None else _r_reflectance_ g_reflectance = 0 if _g_reflectance_ is None else _g_reflectance_ b_reflectance = 0 if _b_reflectance_ is None else _b_reflectance_ reflected_spacularity = 0.5 if _reflected_spacularity_ is None else _reflected_spacularity_ roughness = 0 if _roughness_ is None else _roughness_ transmitted_diff = 0.5 if _transmitted_diff_ is None else _transmitted_diff_ transmitted_spec = 0.5 if _transmitted_spec_ is None else _transmitted_spec_ modifier = _modifier_ or "void" material = Trans.from_reflected_spacularity(name, r_reflectance, g_reflectance, b_reflectance, reflected_spacularity, roughness, transmitted_diff, transmitted_spec, modifier)