def test_aperture_init(): """Test the initialization of Aperture objects.""" pts = (Point3D(0, 0, 0), Point3D(0, 0, 3), Point3D(5, 0, 3), Point3D(5, 0, 0)) unique_id = str(py_uuid.uuid4()) aperture = Aperture(unique_id, Face3D(pts)) aperture.display_name = 'Test Window' str(aperture) # test the string representation assert aperture.identifier == unique_id assert aperture.display_name == 'Test Window' assert isinstance(aperture.geometry, Face3D) assert len(aperture.vertices) == 4 assert aperture.upper_left_vertices[0] == Point3D(5, 0, 3) assert len(aperture.triangulated_mesh3d.faces) == 2 assert aperture.normal == Vector3D(0, 1, 0) assert aperture.center == Point3D(2.5, 0, 1.5) assert aperture.area == 15 assert aperture.perimeter == 16 assert isinstance(aperture.boundary_condition, Outdoors) assert not aperture.is_operable assert not aperture.has_parent
window_obj.glazing = glazing window_obj.installs = install window_obj.install_depth = install_depth window_obj.variant_type = aperture_params.get('VariantType', 'a') window_EP_material = LBT2PH.windows.create_EP_window_mat(window_obj) window_EP_const = LBT2PH.windows.create_EP_const(window_EP_material) #--------------------------------------------------------------------------- # Inset the Surface just a little bit to ensure it can be hosted properly inset_ap_geometry = LBT2PH.helpers_geometry.inset_LBT_Face3d( aperture.geometry, 0.0005) #--------------------------------------------------------------------------- # Create a new Aperture object and modify it's properties # Package up the data onto the 'Aperture' objects' user_data new_ap = Aperture(aperture.identifier, inset_ap_geometry, is_operable=aperture.is_operable) new_ap.properties.energy.construction = window_EP_const new_name = aperture_params.get('Object Name', None) if new_name: new_ap.display_name = new_name new_ap = LBT2PH.helpers.add_to_HB_model(new_ap, 'phpp', window_obj.to_dict(), ghenv, 'overwrite') apertures_.append(new_ap)
if all_required_inputs(ghenv.Component): apertures = [] # list of apertures that will be returned for j, geo in enumerate(_geo): if len(_name_) == 0: # make a default Aperture name name = display_name = clean_and_id_string('Aperture') else: display_name = '{}_{}'.format(longest_list(_name_, j), j + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, j) name = clean_and_id_string(display_name) operable = longest_list(operable_, j) if len(operable_) != 0 else False lb_faces = to_face3d(geo) for i, lb_face in enumerate(lb_faces): ap_name = '{}_{}'.format(name, i) if len(lb_faces) > 1 else name hb_ap = Aperture(ap_name, lb_face, is_operable=operable) hb_ap.display_name = display_name # try to assign the energyplus construction if len(ep_constr_) != 0: ep_constr = longest_list(ep_constr_, j) if isinstance(ep_constr, str): ep_constr = window_construction_by_identifier(ep_constr) hb_ap.properties.energy.construction = ep_constr # try to assign the radiance modifier if len(rad_mod_) != 0: rad_mod = longest_list(rad_mod_, j) if isinstance(rad_mod, str): rad_mod = modifier_by_identifier(rad_mod) hb_ap.properties.radiance.modifier = rad_mod