]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH_SWIG/smeshBuilder.py
Salome HOME
0022364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms...
[modules/smesh.git] / src / SMESH_SWIG / smeshBuilder.py
index 966b5fd81606312342996c7631f3e662df6c13d8..98b192177bc72f44baa5b317df4e1c8ab36ca251 100644 (file)
@@ -1563,15 +1563,23 @@ class Mesh:
             if not geom:
                 geom = self.mesh.GetShapeToMesh()
             pass
-        AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
-        status = self.mesh.AddHypothesis(geom, hyp)
-        isAlgo = hyp._narrow( SMESH_Algo )
-        hyp_name = GetName( hyp )
+        hyp_name = hyp.GetName()
+        lib_name = hyp.GetLibName()
         geom_name = ""
         if geom:
-            geom_name = GetName( geom )
-        TreatHypoStatus( status, hyp_name, geom_name, isAlgo )
-        return status
+            geom_name = geom.GetName()
+        isApplicable = True
+        isAlgo = hyp._narrow( SMESH_Algo )
+        if self.mesh.HasShapeToMesh():
+            isApplicable = self.smeshpyD.IsApplicable(hyp_name, lib_name, geom, not geom.IsSame( self.mesh.GetShapeToMesh() ) )
+        if isApplicable:
+            AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
+            status = self.mesh.AddHypothesis(geom, hyp)
+            TreatHypoStatus( status, hyp_name, geom_name, isAlgo )
+            return status
+        else:
+            TreatHypoStatus( HYP_BAD_GEOMETRY, hyp_name, geom_name, isAlgo )
+            return HYP_BAD_GEOMETRY
 
     ## Return True if an algorithm of hypothesis is assigned to a given shape
     #  @param hyp a hypothesis to check