Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / defining_hypotheses_ex05.py
1 # Maximum Element Area
2
3 import salome
4 salome.salome_init_without_session()
5
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
8
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
11
12 # create a face
13 px   = geom_builder.MakeVertex(100., 0.  , 0.  )
14 py   = geom_builder.MakeVertex(0.  , 100., 0.  )
15 pz   = geom_builder.MakeVertex(0.  , 0.  , 100.)
16
17 vxy = geom_builder.MakeVector(px, py)
18 arc = geom_builder.MakeArc(py, pz, px)
19 wire = geom_builder.MakeWire([vxy, arc])
20
21 isPlanarFace = 1
22 face = geom_builder.MakeFace(wire, isPlanarFace)
23
24 # add the face in the study
25 id_face = geom_builder.addToStudy(face, "Face to be meshed")
26
27 # create a mesh
28 tria_mesh = smesh_builder.Mesh(face, "Face : triangulation")
29
30 # define 1D meshing:
31 algo = tria_mesh.Segment()
32 algo.NumberOfSegments(20)
33
34 # define 2D meshing:
35
36 # assign triangulation algorithm
37 algo = tria_mesh.Triangle()
38
39 # assign "Max Element Area" hypothesis
40 algo.MaxElementArea(100)
41
42 # compute the mesh
43 tria_mesh.Compute()