From 997200d3b4dcef6beecebe198963704c7d7b23ec Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Tue, 9 May 2017 14:21:32 +0800 Subject: [PATCH] Path.Area: add parameter 'Outline' to remove inner holes --- src/Mod/Path/App/Area.cpp | 14 ++++++++++++++ src/Mod/Path/App/AreaParams.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 2af48e8250..c60bcc0f9e 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -977,6 +977,7 @@ std::list Area::project(const TopoDS_Shape &solid) area.myParams.Explode = false; area.myParams.FitArcs = false; area.myParams.Reorient = false; + area.myParams.Outline = false; area.myParams.Coplanar = CoplanarNone; area.add(joiner.comp, OperationUnion); TopoDS_Shape shape = area.getShape(); @@ -1358,6 +1359,19 @@ void Area::build() { myArea = std::move(area.myArea); } + if(myParams.Outline) { + myArea->Reorder(); + for(auto it=myArea->m_curves.begin(),itNext=it; + it!=myArea->m_curves.end(); + it=itNext) + { + ++itNext; + auto &curve = *it; + if(curve.IsClosed() && curve.IsClockwise()) + myArea->m_curves.erase(it); + } + } + TIME_TRACE(t,"prepare"); }catch(...) { diff --git a/src/Mod/Path/App/AreaParams.h b/src/Mod/Path/App/AreaParams.h index 362e4c640b..9df150fddc 100644 --- a/src/Mod/Path/App/AreaParams.h +++ b/src/Mod/Path/App/AreaParams.h @@ -60,6 +60,8 @@ "but 'Check' only gives warning.",(None)(Check)(Force)))\ ((bool,reorient,Reorient,true,\ "Re-orient closed wires in wire only shapes so that inner wires become holes."))\ + ((bool,outline,Outline,false,\ + "Remove all inner wires (holes) before output the final shape"))\ ((bool,explode,Explode,false,\ "If true, Area will explode the first shape into disconnected open edges, \n"\ "with all curves discretized, so that later operations like 'Difference' \n"\