diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index aedab6bcf..927969dbb 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -306,6 +306,12 @@ module SMESH void Clear() raises (SALOME::SALOME_Exception); + /*! + * Get the list of sub-meshes existing in the mesh + */ + submesh_array GetSubMeshes() + raises (SALOME::SALOME_Exception); + /*! * Remove all nodes and elements of submesh */ diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 6de641a3f..a3feab7a4 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -76,6 +76,7 @@ + diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 17b974e3c..07d8f2edd 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -665,6 +665,42 @@ throw(SALOME::SALOME_Exception) return aList._retn(); } +SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes() throw (SALOME::SALOME_Exception) +{ + Unexpect aCatch(SALOME_SalomeException); + if (MYDEBUG) MESSAGE("GetSubMeshes"); + + SMESH::submesh_array_var aList = new SMESH::submesh_array(); + + // Python Dump + TPythonDump aPythonDump; + if ( !_mapSubMeshIor.empty() ) + aPythonDump << "[ "; + + try { + aList->length( _mapSubMeshIor.size() ); + int i = 0; + map::iterator it = _mapSubMeshIor.begin(); + for ( ; it != _mapSubMeshIor.end(); it++ ) { + if ( CORBA::is_nil( it->second )) continue; + aList[i++] = SMESH::SMESH_subMesh::_duplicate( it->second ); + // Python Dump + if (i > 1) aPythonDump << ", "; + aPythonDump << it->second; + } + aList->length( i ); + } + catch(SALOME_Exception & S_ex) { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + // Update Python script + if ( !_mapSubMeshIor.empty() ) + aPythonDump << " ] = " << _this() << ".GetSubMeshes()"; + + return aList._retn(); +} + //============================================================================= /*! * diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index d5109faf1..dcd2bc537 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -88,6 +88,9 @@ public: SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject) throw (SALOME::SALOME_Exception); + SMESH::submesh_array* GetSubMeshes() + throw (SALOME::SALOME_Exception); + SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName) throw (SALOME::SALOME_Exception);