int firstPointID = ngMesh.GetNP() + 1;
int edgeID = 1, posID = -2;
+ bool isInternalEdge = false;
for ( int i = 0; i < wire->NbSegments(); ++i ) // loop on segments
{
// Add the first point of a segment
const TopoDS_Edge& edge = wire->Edge( wire->EdgeIndex( normParam ));
edgeID = geom.emap.FindIndex( edge );
posID = posShapeID;
+ isInternalEdge = ( edge.Orientation() == TopAbs_INTERNAL );
if ( onVertex ) // param on curve is different on each of two edges
seg.epgeominfo[ iEnd ].dist = helper.GetNodeU( edge, pnt.node );
}
// << "\tp1 param: " << seg.epgeominfo[ 1 ].dist << endl
// << "\tp1 uv: " << seg.epgeominfo[ 1 ].u <<", "<< seg.epgeominfo[ 1 ].v << endl
// << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl;
- }
- Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() );
+
+ if ( isInternalEdge )
+ {
#ifdef NETGEN_NEW
- seg.pnums[1] = firstPointID;
+ swap (seg.pnums[0], seg.pnums[1]);
#else
- seg.p2 = firstPointID;
+ swap (seg.p1, seg.p2);
#endif
- }
+ swap( seg.epgeominfo[0], seg.epgeominfo[1] );
+ seg.edgenr = ngMesh.GetNSeg() + 1; // segment id
+ ngMesh.AddSegment (seg);
+ }
+ } // loop on segments on a wire
+
+ // close chain of segments
+ bool isClosedWire = ( wire->FirstVertex().IsSame( wire->LastVertex() ));
+ if ( isClosedWire )
+ {
+ Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() );
+#ifdef NETGEN_NEW
+ seg.pnums[1] = firstPointID;
+#else
+ seg.p2 = firstPointID;
+#endif
+ }
+ else // INTERNAL wire (Issue 0020676)
+ {
+ const SMDS_MeshNode * n = uvPtVec.back().node;
+ nodeVec.push_back( n );
+
+ MeshPoint mp( Point<3> (n->X(), n->Y(), n->Z()) );
+ ngMesh.AddPoint ( mp, 1, EDGEPOINT );
+ }
+
+ } // loop on wires of a face
ngMesh.CalcSurfacesOfNode();