From 1eb7dc9cd0312d0c9a46d0342e026cd17dd01a03 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 4 Aug 2014 17:37:39 +0400 Subject: [PATCH] 0052474: Body Fitting with "Implement Edges"=ON crashes SALOME Fix sortVertexNodes() for the case of a FACE with several WIREs --- src/StdMeshers/StdMeshers_Cartesian_3D.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx index 8b40fe2d9..3cd23ff35 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D.cxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D.cxx @@ -3021,10 +3021,10 @@ namespace list< int > nbEdges; int nbW = SMESH_Block::GetOrderedEdges (face, edges, nbEdges); if ( nbW > 1 ) { - // select a WIRE + // select a WIRE - remove EDGEs of irrelevant WIREs from edges list< TopoDS_Edge >::iterator e = edges.begin(), eEnd = e; list< int >::iterator nE = nbEdges.begin(); - for ( ; nbW ; ++nE, --nbW ) + for ( ; nbW > 0; ++nE, --nbW ) { std::advance( eEnd, *nE ); for ( ; e != eEnd; ++e ) @@ -3037,13 +3037,14 @@ namespace ( std::find( &nShapeIds[0], nShapeIdsEnd, id ) != nShapeIdsEnd )) { edges.erase( eEnd, edges.end() ); // remove rest wires - e = eEnd; + e = eEnd = edges.end(); + --e; nbW = 0; break; } } if ( nbW > 0 ) - edges.erase( edges.begin(), eEnd ); // remove a current wire + edges.erase( edges.begin(), eEnd ); // remove a current irrelevant wire } } // rotate edges to have the first one at least partially out of the hexa -- 2.39.2