+ //================================================================================
+ /*!
+ * \brief Returns an EDGE suitable for search of initial vertex association
+ */
+ //================================================================================
+
+ TopoDS_Shape getOuterEdge( const TopoDS_Shape theShape1, SMESH_Mesh& mesh )
+ {
+ TopoDS_Shape edge;
+ if ( theShape1.ShapeType() == TopAbs_COMPOUND )
+ {
+ TopoDS_Iterator it( theShape1 );
+ if ( it.Value().ShapeType() == TopAbs_FACE ) // group of FACEs
+ {
+ // look for a boundary EDGE of a group
+ edge = StdMeshers_ProjectionUtils::GetBoundaryEdge( theShape1, mesh );
+ if ( !edge.IsNull() )
+ return edge;
+ }
+ }
+ edge = theShape1;
+ TopExp_Explorer expF( theShape1, TopAbs_FACE ), expE;
+ if ( expF.More() ) {
+ for ( ; expF.More(); expF.Next() ) {
+ edge.Nullify();
+ TopoDS_Shape wire =
+ StdMeshers_ProjectionUtils::OuterShape( TopoDS::Face( expF.Current() ), TopAbs_WIRE );
+ for ( expE.Init( wire, TopAbs_EDGE ); edge.IsNull() && expE.More(); expE.Next() )
+ if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() )))
+ edge = expE.Current();
+ if ( !edge.IsNull() )
+ break;
+ }
+ } else if (edge.ShapeType() != TopAbs_EDGE) { // no faces
+ edge.Nullify();
+ for ( expE.Init( theShape1, TopAbs_EDGE ); edge.IsNull() && expE.More(); expE.Next() )
+ if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() )))
+ edge = expE.Current();
+ }
+ return edge;
+ }
+