]> SALOME platform Git repositories - modules/smesh.git/blobdiff - doc/salome/examples/defining_hypotheses_ex02.py
Salome HOME
Merge from V6_main 11/02/2013
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex02.py
diff --git a/doc/salome/examples/defining_hypotheses_ex02.py b/doc/salome/examples/defining_hypotheses_ex02.py
new file mode 100644 (file)
index 0000000..b0726a1
--- /dev/null
@@ -0,0 +1,40 @@
+# Deflection 1D and Number of Segments
+
+import geompy
+import smesh
+
+# create a face from arc and straight segment
+px = geompy.MakeVertex(100., 0.  , 0.  )
+py = geompy.MakeVertex(0.  , 100., 0.  )
+pz = geompy.MakeVertex(0.  , 0.  , 100.)
+
+exy = geompy.MakeEdge(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+wire = geompy.MakeWire([exy, arc])
+
+isPlanarFace = 1
+face1 = geompy.MakeFace(wire, isPlanarFace)
+geompy.addToStudy(face1,"Face1")
+
+# get edges from the face
+e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
+geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
+
+# create hexahedral mesh
+hexa = smesh.Mesh(face1, "Face : triangle mesh")
+
+# define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
+algo1D = hexa.Segment()
+algo1D.NumberOfSegments(6)
+
+# define "MaxElementArea" hypothesis
+algo2D = hexa.Triangle()
+algo2D.MaxElementArea(70.0)
+
+# define a local "Deflection1D" hypothesis on the arc
+algo_local = hexa.Segment(e_arc)
+algo_local.Deflection1D(1.0)
+
+# compute the mesh
+hexa.Compute()