diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 409ce1441..0c044553f 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1724,6 +1724,7 @@ void CloseWindows(ContourVector& contours, BOOST_FOREACH(const TempOpening* opening, refs) { BOOST_FOREACH(const IfcVector3& other, opening->wallPoints) { const IfcFloat sqdist = (world_point - other).SquareLength(); + if (sqdist < best) { bestv = other; best = sqdist; @@ -2262,7 +2263,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul out.push_back(in[next]); if(openings) { - if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true)) { + if(GenerateOpenings(*conv.apply_openings,nors,temp,false, true)) { ++sides_with_openings; } @@ -2270,6 +2271,12 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul temp.Clear(); } } + + if(openings) { + BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) { + opening.wallPoints.clear(); + } + } size_t sides_with_v_openings = 0; if(has_area) {