BRep_Builder BB;
BB.MakeFace(F);
+ NCollection_Sequence<NCollection_Sequence<TopoDS_Edge> > allEdges;
+
TopTools_SequenceOfShape aWires;
for ( int i = 0 ; i < nParts ; i++ )
{
EndIndex = anObj->panPartStart[i + 1];
else
EndIndex = anObj->nVertices;
-
- TopoDS_Wire W;
- BB.MakeWire(W);
+
+ NCollection_Sequence<TopoDS_Edge> EPerW;
//First point is same as the last point
int NbPnts = EndIndex - StartIndex - 1;
E = BRepLib_MakeEdge(aTC, VPoints.First(), VPoints.Value(VPoints.Upper() - 1)).Edge();
//Add edge to wire
//If SHP file is correct then the outer wire and the holes will have the correct orientations
- BB.Add(W, E);
+
+ EPerW.Append(E);
}
- //Wire must be closed anyway
- W.Closed (BRep_Tool::IsClosed (W));
+ allEdges.Append(EPerW);
+ }
+
+ for (int i = 1; i <= allEdges.Size(); i++)
+ {
+ TopoDS_Wire W;
+ BB.MakeWire(W);
+ for (int j = 1; j <= allEdges(i).Size(); j++)
+ BB.Add(W, allEdges(i)(j));
+ W.Closed (Standard_True);
W.Orientation(TopAbs_FORWARD);
+ //check on the dummy face first
+ TopoDS_Face DF;
+ BB.MakeFace(DF);
+ BB.Add(DF, W);
+ BB.UpdateFace(DF, aPlaneSur, TopLoc_Location(), Precision::Confusion());
+ //
+ BRepTopAdaptor_FClass2d FClass(DF, Precision::PConfusion());
+ if ( i == 1 && FClass.PerformInfinitePoint() != TopAbs_OUT)
+ W.Reverse();
+ if ( i > 1 && FClass.PerformInfinitePoint() != TopAbs_IN)
+ W.Reverse();
+ //
BB.Add(F, W);
}