]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/creating_meshes_ex01.py
Salome HOME
update of messages
[modules/smesh.git] / doc / salome / examples / creating_meshes_ex01.py
1 # Construction of a Mesh
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 import SMESH, SALOMEDS
10 from salome.smesh import smeshBuilder
11 smesh =  smeshBuilder.New(salome.myStudy)
12
13 # create a box
14 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
15 idbox = geompy.addToStudy(box, "box")
16
17 # create a mesh
18 tetra = smesh.Mesh(box, "MeshBox")
19
20 algo1D = tetra.Segment()
21 algo1D.NumberOfSegments(7)
22
23 algo2D = tetra.Triangle()
24 algo2D.MaxElementArea(800.)
25
26 algo3D = tetra.Tetrahedron()
27 algo3D.MaxElementVolume(900.)
28
29 # compute the mesh
30 ret = tetra.Compute()
31 if ret == 0:
32     print "problem when computing the mesh"
33 else:
34     print "mesh computed"
35     pass