diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 0f80a7094d..b3f2440dcc 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -2963,20 +2963,19 @@ std::list Area::sortWires(const std::list &shapes, pstart = *_pstart; bool use_bound = !has_start || _pstart==NULL; - if(use_bound || sort_mode == SortMode2D5 || sort_mode == SortModeGreedy) { - //Second stage, group shape by its plane, and find overall boundary + //Second stage, group shape by its plane, and find overall boundary - if(arcPlaneFound || use_bound) { - for(auto &info : shape_list) { - if(arcPlaneFound) { - info.myShape.Move(trsf); - if(info.myPlanar) info.myPln.Transform(trsf); - } - if(use_bound) - BRepBndLib::Add(info.myShape, bounds, Standard_False); - } + for(auto &info : shape_list) { + if(arcPlaneFound) { + info.myShape.Move(trsf); + if(info.myPlanar) info.myPln.Transform(trsf); } + BRepBndLib::Add(info.myShape, bounds, Standard_False); + } + + if(use_bound || sort_mode == SortMode2D5 || sort_mode == SortModeGreedy) { + for(auto itNext=shape_list.begin(),it=itNext;it!=shape_list.end();it=itNext) { ++itNext; if(!it->myPlanar) continue; @@ -3005,16 +3004,36 @@ std::list Area::sortWires(const std::list &shapes, //FC_DURATION_DECL_INIT(td); + bounds.SetGap(0.0); + Standard_Real xMin, yMin, zMin, xMax, yMax, zMax; + bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax); + AREA_TRACE("bound (" << xMin<<", "<