diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 47a8bffd9..a6f7b1b69 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -748,8 +748,11 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: return false; } - curmesh.verts.clear(); - curmesh.vertcnt.clear(); + std::vector old_verts; + std::vector old_vertcnt; + + old_verts.swap(curmesh.verts); + old_vertcnt.swap(curmesh.vertcnt); // add connection geometry to close the adjacent 'holes' for the openings @@ -864,6 +867,15 @@ bool TryAddOpenings_Poly2Tri(const std::vector& openings,const std: #undef from_int64 #undef from_int64_f + + if (!result) { + // revert -- it's a shame, but better than nothing + curmesh.verts.insert(curmesh.verts.end(),old_verts.begin(), old_verts.end()); + curmesh.vertcnt.insert(curmesh.vertcnt.end(),old_vertcnt.begin(), old_vertcnt.end()); + + IFCImporter::LogError("Ifc: revert, could not generate openings for this wall"); + } + return result; }