SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
ASSERT( aServant );
aServant->ImportUNVFile( theFileName );
+
+ // Dump creation of groups
+ aServant->GetGroups();
+
return aMesh._retn();
}
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMeshFromMED" );
- // Python Dump
- TPythonDump aPythonDump;
- aPythonDump << "([";
- //TCollection_AsciiString aStr ("([");
-
// Retrieve mesh names from the file
DriverMED_R_SMESHDS_Mesh myReader;
myReader.SetFile( theFileName );
list<string> aNames = myReader.GetMeshNames(aStatus);
SMESH::mesh_array_var aResult = new SMESH::mesh_array();
theStatus = (SMESH::DriverMED_ReadStatus)aStatus;
+
+ { // open a new scope to make aPythonDump die before PythonDump in SMESH_Mesh::GetGroups()
+
+ // Python Dump
+ TPythonDump aPythonDump;
+ aPythonDump << "([";
+ //TCollection_AsciiString aStr ("([");
+
if (theStatus == SMESH::DRS_OK) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
// Update Python script
aPythonDump << "], status) = " << this << ".CreateMeshesFromMED('" << theFileName << "')";
+ }
+ // Dump creation of groups
+ for ( int i = 0; i < aResult->length(); ++i )
+ aResult[ i ]->GetGroups();
return aResult._retn();
}
_gen_i->RemoveLastFromPythonScript(_gen_i->GetCurrentStudy()->StudyId());
}
+
+//================================================================================
+/*!
+ * \brief Get the list of groups existing in the mesh
+ * \retval SMESH::ListOfGroups * - list of groups
+ */
+//================================================================================
+
+SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups() throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ if (MYDEBUG) MESSAGE("GetGroups");
+
+ SMESH::ListOfGroups_var aList = new SMESH::ListOfGroups();
+ // Python Dump
+ TPythonDump aPythonDump;
+ aPythonDump << "[ ";
+
+ try {
+ aList->length( _mapGroups.size() );
+ int i = 0;
+ map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.begin();
+ for ( ; it != _mapGroups.end(); it++ ) {
+ if ( CORBA::is_nil( it->second )) continue;
+ aList[i++] = SMESH::SMESH_GroupBase::_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
+ aPythonDump << " ] = " << _this() << ".GetGroups()";
+
+ return aList._retn();
+}
+
//=============================================================================
/*! UnionGroups
* New group is created. All mesh elements that are
void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
throw (SALOME::SALOME_Exception);
+ SMESH::ListOfGroups* GetGroups()
+ throw (SALOME::SALOME_Exception);
+
SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
const char* theName )