Hi all,
I have some problems with creating geometry in IfcOpenShell & thought maybe some of you could help me. Here's the problem:
I have a face with one or more interior holes (as a python list of lists, where the first list corresponds to the outer boundary and the others are all interior holes). In the case of the figure, it looks like: [[1,2,3,4],[5,6,7,8],[9,10,11,12]]. I'd like to convert that to a IfcFace.
The code now looks like this. IFC_vertices is a dictionary of IfcCartesianPoints based on the vertex index.
IFC_model = ifcopenshell.open("ifcmodel.ifc")
face = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
cartesian_points = []
for vertex in face[0]:
cartesian_points.append(IFC_vertices[vertex])
polyloop = IFC_model.create_entity("IfcPolyLoop", Polygon=cartesian_points)
outerbound = IFC_model.create_entity("IfcFaceOuterBound", Bound=polyloop, Orientation=True) # orientation of vertices is CCW
innerbounds = []
for interior_face in face[1:]:
for vertex in interior_face:
cartesian_points.append(IFC_vertices[vertex])
polyloop = IFC_model.create_entity("IfcPolyLoop", Polygon=cartesian_points)
innerbounds.append(IFC_model.create_entity("IfcFaceBound", Bound=polyloop, Orientation=False)) # orientation of vertices is CW
IFC_model.create_entity("IfcFace", Bounds=[outerbound] + innerbounds)
I thought it was pretty straightforward this way, as it is explained in the BuildingSMART documentation. But there is definitely something wrong with the IfcFaceBounds / IfcOuterFaceBounds. Here's an output of such a case in BlenderBIM (likely not a bug there because in Solibri it looks similar):
Is there any IFC/IfcOpenShell hero that knows what went wrong in the code?