MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / create_case

Function create_case

src/ifcopenshell-python/test/test_wall_opening.py:103–143  ·  view source on GitHub ↗
(fn, openings)

Source from the content-addressed store, hash-verified

101
102
103def 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
146class TestWallOpenings:

Callers 1

test_allMethod · 0.85

Calls 8

create_ifclocalplacementFunction · 0.85
create_ifcaxis2placementFunction · 0.85
newMethod · 0.80
createMethod · 0.45
by_typeMethod · 0.45
buildMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected