Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex02.py
1 # Deflection 1D and Number of Segments
2
3 import geompy
4 import smesh
5
6 # create a face from arc and straight segment
7 px = geompy.MakeVertex(100., 0.  , 0.  )
8 py = geompy.MakeVertex(0.  , 100., 0.  )
9 pz = geompy.MakeVertex(0.  , 0.  , 100.)
10
11 exy = geompy.MakeEdge(px, py)
12 arc = geompy.MakeArc(py, pz, px)
13
14 wire = geompy.MakeWire([exy, arc])
15
16 isPlanarFace = 1
17 face1 = geompy.MakeFace(wire, isPlanarFace)
18 geompy.addToStudy(face1,"Face1")
19
20 # get edges from the face
21 e_straight,e_arc = geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])
22 geompy.addToStudyInFather(face1, e_arc, "Arc Edge")
23
24 # create hexahedral mesh
25 hexa = smesh.Mesh(face1, "Face : triangle mesh")
26
27 # define "NumberOfSegments" hypothesis to cut a straight edge in a fixed number of segments
28 algo1D = hexa.Segment()
29 algo1D.NumberOfSegments(6)
30
31 # define "MaxElementArea" hypothesis
32 algo2D = hexa.Triangle()
33 algo2D.MaxElementArea(70.0)
34
35 # define a local "Deflection1D" hypothesis on the arc
36 algo_local = hexa.Segment(e_arc)
37 algo_local.Deflection1D(1.0)
38
39 # compute the mesh
40 hexa.Compute()