(fn, openings)
| 101 | |
| 102 | |
| 103 | def create_case(fn, openings): |
| 104 | f = ifcopenshell.template.create() |
| 105 | |
| 106 | owner_history = f.by_type("IfcOwnerHistory")[0] |
| 107 | project = f.by_type("IfcProject")[0] |
| 108 | context = f.by_type("IfcGeometricRepresentationContext")[0] |
| 109 | |
| 110 | wall_placement = create_ifclocalplacement(f, relative_to=None) |
| 111 | |
| 112 | extrusion_placement = create_ifcaxis2placement(f, (0.0, 0.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0)) |
| 113 | point_list_extrusion_area = [ |
| 114 | (0.0, -0.2, 0.0), |
| 115 | (15.0, -0.2, 0.0), |
| 116 | (15.0, 0.0, 0.0), |
| 117 | (0.0, 0.0, 0.0), |
| 118 | (0.0, -0.2, 0.0), |
| 119 | ] |
| 120 | solid = create_ifcextrudedareasolid(f, point_list_extrusion_area, extrusion_placement, (0.0, 0.0, 1.0), 4.0) |
| 121 | body_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [solid]) |
| 122 | |
| 123 | product_shape = f.createIfcProductDefinitionShape(None, None, [body_representation]) |
| 124 | |
| 125 | wall = f.createIfcWallStandardCase( |
| 126 | ifcopenshell.guid.new(), owner_history, "Wall", None, None, wall_placement, product_shape, None |
| 127 | ) |
| 128 | |
| 129 | for opening in openings: |
| 130 | opening_placement = create_ifclocalplacement( |
| 131 | f, (opening.x, 0.0, opening.z), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0), wall_placement |
| 132 | ) |
| 133 | opening_solid = f.createIfcExtrudedAreaSolid( |
| 134 | opening.shape.build(f), None, f.createIfcDirection(opening.direc), opening.depth |
| 135 | ) |
| 136 | opening_representation = f.createIfcShapeRepresentation(context, "Body", "SweptSolid", [opening_solid]) |
| 137 | opening_shape = f.createIfcProductDefinitionShape(None, None, [opening_representation]) |
| 138 | opening_element = f.createIfcOpeningElement( |
| 139 | ifcopenshell.guid.new(), owner_history, "Opening", None, None, opening_placement, opening_shape, None |
| 140 | ) |
| 141 | f.createIfcRelVoidsElement(ifcopenshell.guid.new(), owner_history, None, None, wall, opening_element) |
| 142 | |
| 143 | f.write(fn) |
| 144 | |
| 145 | |
| 146 | class TestWallOpenings: |
no test coverage detected