X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Mesh_i.cxx;h=e028b610755a69fcdf784f068e688e7fbe8df6c6;hb=790c5cfa903e3b809e6bd5b7aefed48d17f15dc5;hp=a088cce96db094346ec184926c181c892ce13fe8;hpb=ac724740a914d5008bc0038a4d3fa6397b6cb87f;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index a088cce96..e028b6107 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -2070,6 +2070,18 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType theElem const char* theName, const TopoDS_Shape& theShape ) { + std::string newName; + if ( !theName || strlen( theName ) == 0 ) + { + std::set< std::string > presentNames; + std::map::const_iterator i_gr = _mapGroups.begin(); + for ( ; i_gr != _mapGroups.end(); ++i_gr ) + presentNames.insert( i_gr->second->GetName() ); + do { + newName = "noname_Group_" + SMESH_Comment( presentNames.size() + 1 ); + } while ( !presentNames.insert( newName ).second ); + theName = newName.c_str(); + } int anId; SMESH::SMESH_GroupBase_var aGroup; if ( _impl->AddGroup( (SMDSAbs_ElementType)theElemType, theName, anId, theShape )) { @@ -2810,7 +2822,7 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemTy // No sense in returning ids of elements along with ids of nodes: // when theElemType == SMESH::ALL, return node ids only if // there are no elements - if ( theElemType == SMESH::NODE || theElemType == SMESH::ALL && nbElements == 0 ) + if ( theElemType == SMESH::NODE || (theElemType == SMESH::ALL && nbElements == 0) ) return GetNodesId(); aResult->length( nbElements );