Salome HOME
Initial version of files for OCC developers
[modules/smesh.git] / src / SMESH_SWIG / meshpy.py
index effc62d1db8d1503709f586734fe1006dfa72d67..7af956296002f6135d8141af4c172eb691a54b3e 100644 (file)
@@ -37,7 +37,7 @@ class MeshHexaImpl:
     #   - hypothesis "NumberOfSegments" with number of segments <n>
     # --------------------
 
-    def Mesh1D(self, shape, n):
+    def Mesh1D(self, shape, n, propagate=0):
         hyp1D=smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
         smeshgui.SetName(salome.ObjectToID(hyp1D), self.name+"/WireDiscretisation/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp1D)
@@ -47,6 +47,11 @@ class MeshHexaImpl:
         smeshgui.SetName(salome.ObjectToID(hyp), self.name+"/Segments_"+str(n)+"/"+str(self.cpt))
         self.mesh.AddHypothesis(shape, hyp)
 
+        if propagate:
+            hypPro=smesh.CreateHypothesis("Propagation", "libStdMeshersEngine.so")
+            smeshgui.SetName(salome.ObjectToID(hypPro), self.name+"/Propagation/"+str(self.cpt))
+            self.mesh.AddHypothesis(shape, hypPro)
+
         self.cpt=self.cpt+1
 
     # Constructor
@@ -93,6 +98,20 @@ class MeshHexaImpl:
         submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
         self.Mesh1D(edge, n)
 
+    # Creates sub-mesh of the mesh, created by constructor.
+    # This sub-mesh will be created on edge <edge> and propagate the hypothesis on all correspondant edges.
+    # Set algorithm and hypothesis for 1D discretization of the <edge> and all other propagate edges:
+    #   - algorithm  "Regular_1D"
+    #   - hypothesis "NumberOfSegments" with number of segments <n>
+    #   - hypothesis "Propagation" with number of segments <n>
+    # Note: the <edge> will be automatically published in study under the shape, given in constructor.
+    # --------------------
+
+    def Propagate(self, edge, n):
+        geompy.addToStudyInFather(self.piece, edge, geompy.SubShapeName(edge, self.piece))
+        submesh = self.mesh.GetSubMesh(edge, self.name+"/SubMeshEdge/"+str(self.cpt))
+        self.Mesh1D(edge, n, 1)
+
     # Computes mesh, created by constructor.
     # --------------------