Hi there,
I am using IfcOpenShell to create an IFC model.
Everything works fine but I realized that making openings is really slowing my code down, so a medium size model containing multiple buildings takes up to 6 minutes to generate.
My code for making openings looks like this :
for aperture_outline in aperture_outlines:
z_aperture_outline = aperture_outline['openingOutline']['data']['pts'][0]['data']['z']
height_above_slab = z_aperture_outline - z_facade
if abs(z_pos) > 0.01:
height_above_slab += z_pos
opening = make_opening(ifcfile, sb, body, ifc_story, facade, aperture_outline, height=0, z_pos=height_above_slab)
def make_opening(ifcfile, sb, body, storey, wall, aperture_outline, height=0, z_pos=0.0):
opening = ifcopenshell.api.run("root.create_entity", ifcfile, ifc_class="IfcOpeningElement", name="Opening")
points = aperture_outline['openingOutline']['data']['pts']
height = aperture_outline['height']
pts = convert_points(points)
profile = sb.polyline(pts)
extruded_solid = sb.extrude(profile, magnitude=height, position=mathutils.Vector((0.0, 0.0, z_pos)), extrusion_vector=mathutils.Vector((0.0, 0.0, 1.0)))
representation = sb.get_representation(body, extruded_solid)
ifcopenshell.api.run("geometry.assign_representation", ifcfile, product=opening, representation=representation)
ifcopenshell.api.run("spatial.assign_container", ifcfile, product=opening, relating_structure=storey)
ifcopenshell.api.run("geometry.edit_object_placement", ifcfile, product=opening)
ifcopenshell.api.run("void.add_opening", ifcfile, opening=opening, element=wall)
return opening
Does someone know any possibility to fix this?
It would help a lot!!
Thank you