Salome HOME
do not clear a command creating a removed group if the command does
authoreap <eap@opencascade.com>
Thu, 3 May 2012 08:40:24 +0000 (08:40 +0000)
committereap <eap@opencascade.com>
Thu, 3 May 2012 08:40:24 +0000 (08:40 +0000)
other job like MakeBoundaryMesh() or DoubleNodeGroupNew()

src/SMESH_I/SMESH_2smeshpy.cxx
src/SMESH_I/SMESH_2smeshpy.hxx

index 9a1f356fe93fcdc4f6d2b99d56eb14cab64b9a2f..dfacfd77c12ef2534e736e632807708aa6b1840f 100644 (file)
@@ -3700,6 +3700,8 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
   if ( !id.IsEmpty() )
     setID( id );
 
+  myCanClearCreationCmd = true;
+
   const _AString& method = theCreationCmd->GetMethod();
   if ( method == "CreateGroup" ) // CreateGroup() --> CreateEmptyGroup()
   {
@@ -3742,6 +3744,12 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
     }
     myFilter = filter;
   }
+  else
+  {
+    // theCreationCmd does something else apart from creation of this group
+    // and thus it can't be cleared if this group is removed
+    myCanClearCreationCmd = false;
+  }
 }
 
 //================================================================================
@@ -3829,9 +3837,9 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
 void _pyGroup::Flush()
 {
   if ( !theGen->IsToKeepAllCommands() &&
-       myCreationCmd && myCreationCmd->MethodStartsFrom("DoubleNode") )
+       myCreationCmd && !myCanClearCreationCmd )
   {
-    myCreationCmd.Nullify();
+    myCreationCmd.Nullify(); // this way myCreationCmd won't be cleared
   }
 }
 
index 1fccb3750c3d96d8937e46160c9b86288deb1734..b1019b72d3b8694ce9563a9edba27a65f926c305 100644 (file)
@@ -579,6 +579,7 @@ DEFINE_STANDARD_HANDLE (_pyFilter, _pyObject);
 class _pyGroup:  public _pySubMesh
 {
   Handle(_pyFilter) myFilter;
+  bool              myCanClearCreationCmd;
 public:
   _pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id=_pyID());
   virtual void Process( const Handle(_pyCommand)& theCommand);