Path.Area: add parameter 'Outline' to remove inner holes

This commit is contained in:
Zheng, Lei
2017-05-09 14:21:32 +08:00
committed by wmayer
parent 9120d6db77
commit 997200d3b4
2 changed files with 16 additions and 0 deletions

View File

@@ -977,6 +977,7 @@ std::list<TopoDS_Wire> 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(...) {

View File

@@ -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"\