SMESH::long_array_var anIds = aGroup->GetListOfID();
SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
- // Update Python script
- TPythonDump() << _this() << ".RemoveGroupWithContents( " << theGroup << " )";
+ TPythonDump pyDump; // Supress dump from RemoveNodes/Elements() and RemoveGroup()
// Remove contents
if ( aGroup->GetType() == SMESH::NODE )
// Remove group
RemoveGroup( theGroup );
- // Clear python lines, created by RemoveNodes/Elements() and RemoveGroup()
- _gen_i->RemoveLastFromPythonScript(_gen_i->GetCurrentStudy()->StudyId());
- _gen_i->RemoveLastFromPythonScript(_gen_i->GetCurrentStudy()->StudyId());
+ // Update Python script
+ pyDump << _this() << ".RemoveGroupWithContents( " << theGroup << " )";
}
-
//================================================================================
/*!
* \brief Get the list of groups existing in the mesh
return aList._retn();
}
+
//=============================================================================
/*!
* Get number of groups existing in the mesh
{
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeGroup()" );
if ( _mapGroups.find( theId ) != _mapGroups.end() ) {
- removeGeomGroupData( _mapGroups[theId] );
+ SMESH::SMESH_GroupBase_ptr group = _mapGroups[theId];
_mapGroups.erase( theId );
- _impl->RemoveGroup( theId );
+ removeGeomGroupData( group );
+ if (! _impl->RemoveGroup( theId ))
+ {
+ // it seems to be a call up from _impl caused by hyp modification (issue 0020918)
+ RemoveGroup( group );
+ }
}
}
-
//=============================================================================
/*!
*
return _studyId;
}
+//=============================================================================
+namespace
+{
+ //!< implementation of struct used to call SMESH_Mesh_i::removeGroup() from
+ // SMESH_Mesh::RemoveGroup() (issue 0020918)
+ struct TRmGroupCallUp_i : public SMESH_Mesh::TRmGroupCallUp
+ {
+ SMESH_Mesh_i* _mesh;
+ TRmGroupCallUp_i(SMESH_Mesh_i* mesh):_mesh(mesh) {}
+ virtual void RemoveGroup (const int theGroupID) { _mesh->removeGroup( theGroupID ); }
+ };
+}
+
//=============================================================================
/*!
*
{
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::SetImpl");
_impl = impl;
+ if ( _impl )
+ _impl->SetRemoveGroupCallUp( new TRmGroupCallUp_i(this));
}
//=============================================================================
{
SALOMEDS::Study_ptr aStudy = _gen_i->GetCurrentStudy();
+ set<int> addedIDs;
::SMESH_Mesh::GroupIteratorPtr groupIt = _impl->GetGroups();
while ( groupIt->more() )
{
map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.find(anId);
if ( it != _mapGroups.end() && !CORBA::is_nil( it->second ))
continue;
+ addedIDs.insert( anId );
SMESH_GroupBase_i* aGroupImpl;
TopoDS_Shape shape;
int nextId = _gen_i->RegisterObject( groupVar );
if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
- // publishing of the groups in the study
+ // publishing the groups in the study
if ( !aStudy->_is_nil() ) {
GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape );
_gen_i->PublishGroup( aStudy, _this(), groupVar, shapeVar, groupVar->GetName());
}
}
+ if ( !addedIDs.empty() )
+ {
+ // python dump
+ set<int>::iterator id = addedIDs.begin();
+ for ( ; id != addedIDs.end(); ++id )
+ {
+ map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.find(*id);
+ int i = std::distance( _mapGroups.begin(), it );
+ TPythonDump() << it->second << " = " << _this() << ".GetGroups()[ "<< i << " ]";
+ }
+ }
}
//=============================================================================
*/
//=============================================================================
-static void findCommonSubMesh
- (list<const SMESH_subMesh*>& theSubMeshList,
- const SMESH_subMesh* theSubMesh,
- set<const SMESH_subMesh*>& theCommon )
+static void findCommonSubMesh (list<const SMESH_subMesh*>& theSubMeshList,
+ const SMESH_subMesh* theSubMesh,
+ set<const SMESH_subMesh*>& theCommon )
{
if ( !theSubMesh )
return;