From 8d96f40934a12483eaec47fb90e9a36dcd81f62d Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 5 Nov 2019 15:27:39 +0100 Subject: [PATCH] Check for inner wires before reinitializing face builder --- src/ifcgeom/IfcGeomFaces.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ifcgeom/IfcGeomFaces.cpp b/src/ifcgeom/IfcGeomFaces.cpp index 2e8d49c1dc..421532ebf8 100644 --- a/src/ifcgeom/IfcGeomFaces.cpp +++ b/src/ifcgeom/IfcGeomFaces.cpp @@ -318,17 +318,20 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& result) } } else if (!fd.all_outer()) { BRepBuilderAPI_MakeFace mf(fd.surface(), fd.outer_wire()); + TopoDS_Face f = mf.Face(); if (mf.IsDone()) { - // Is this necessary - TopoDS_Face f = mf.Face(); - mf.Init(f); + if (std::distance(fd.inner_wires().first, fd.inner_wires().second)) { + mf.Init(f); - for (auto it = fd.inner_wires().first; it != fd.inner_wires().second; ++it) { - mf.Add(*it); + for (auto it = fd.inner_wires().first; it != fd.inner_wires().second; ++it) { + mf.Add(*it); + } + + face_list.Append(mf.Face()); + } else { + face_list.Append(f); } - - face_list.Append(mf.Face()); } } else { for (const auto& w : fd.wires()) {