Salome HOME
PAL13330( When mesh generation does not success, trace where )
authoreap <eap@opencascade.com>
Tue, 10 Apr 2007 14:10:32 +0000 (14:10 +0000)
committereap <eap@opencascade.com>
Tue, 10 Apr 2007 14:10:32 +0000 (14:10 +0000)
-  // Assign new hypotheses and algorithms
+  // First, remove old algos in order to avoid messages on algorithm hiding

src/SMESHGUI/SMESHGUI_MeshOp.cxx

index 26da616e7c61621083f8600c7a762770484e7454..9aa469e68ccf909ef99a60a3f68957f6ebad73ae 100644 (file)
@@ -1720,37 +1720,35 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
   // Set new name
   SMESH::SetName( pObj, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() );
 
-  // Assign new hypotheses and algorithms
+  // First, remove old algos in order to avoid messages on algorithm hiding
+  for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
+  {
+    if ( isAccessibleDim( dim ) && myObjHyps[ dim ][ Algo ].count() > 0 )
+    {
+      SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first();
+      SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
+      if ( anAlgoVar->_is_nil() || // no new algo selected or
+           strcmp(anOldAlgo->GetName(), anAlgoVar->GetName()) ) // algo change
+      {
+        // remove old algorithm
+        SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first() );
+        myObjHyps[ dim ][ Algo ].clear();
+      }
+    }
+  }
+
+  // Assign new algorithms and hypotheses
   for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
   {
     if ( !isAccessibleDim( dim )) continue;
 
     // find or create algorithm
-    bool toDelete = false, toAdd = true;
     SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
-    if ( anAlgoVar->_is_nil() ) {
-      toAdd = false;
-    }
-    if ( myObjHyps[ dim ][ Algo ].count() > 0 ) {
-      SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first();
-      if ( toAdd ) {
-        if ( strcmp(anOldAlgo->GetName(), anAlgoVar->GetName()) == 0 ) {
-          toAdd = false;
-        } else {
-          toDelete = true;
-        }
-      } else {
-        toDelete = true;
-      }
-    }
-    // remove old algorithm
-    if ( toDelete ) {
-      SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first() );
-      myObjHyps[ dim ][ Algo ].clear();
-    }
 
     // assign new algorithm
-    if ( toAdd ) {
+    if ( !anAlgoVar->_is_nil() && // some algo selected and
+         myObjHyps[ dim ][ Algo ].count() == 0 ) // no algo assigned
+    {
       SMESH::SMESH_Mesh_var aMeshVar =
         SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() );
       bool isMesh = !aMeshVar->_is_nil();