Salome HOME
IPAL52460: Optimal Axes button is inert when edit body fitting parameters
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index bc593e2ffc79c4b11256b85e5485685a30c5fe69..71ccf611de811de9a9826cb91c3b1989725717b9 100644 (file)
@@ -83,6 +83,7 @@
 #include "SMESHGUI_TransparencyDlg.h"
 
 #include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
 #include "SMESHGUI_GroupUtils.h"
 #include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_MeshUtils.h"
@@ -3093,15 +3094,26 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
         Handle(SALOME_InteractiveObject) anIObject = selected.First();
         SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
 
-        /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
-        /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects                   */
-        /* Warning : however by internal mechanism all subMeshes icons are changed !                     */
         if ( !aHypothesis->_is_nil() )
         {
-          // BUG 0020378
-          //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
-          SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
-          if (aCreator) {
+          SMESHGUI_GenericHypothesisCreator* aCreator =
+            SMESH::GetHypothesisCreator( SMESH::toQStr( aHypothesis->GetName() ));
+          if (aCreator)
+          {
+            // set geometry of mesh and sub-mesh to aCreator
+            aSel->selectedObjects( selected, "",  /*convertReferences=*/false);
+            if ( selected.Extent() == 1 )
+            {
+              QString subGeomID, meshGeomID;
+              Handle(SALOME_InteractiveObject) hypIO = selected.First();
+              if ( SMESH::GetGeomEntries( hypIO, subGeomID, meshGeomID ))
+              {
+                if ( subGeomID.isEmpty() ) subGeomID = meshGeomID;
+                aCreator->setShapeEntry( subGeomID );
+                aCreator->setMainShapeEntry( meshGeomID );
+              }
+            }
+
             aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop(), this, SLOT( onHypothesisEdit( int ) ) );
           }
           else