]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/notebook_smesh.py
Salome HOME
[bos #23982] EDF 22984 - aspect ratio of hexa
[modules/smesh.git] / doc / salome / examples / notebook_smesh.py
1 # Using SALOME NoteBook
2
3
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New()
9
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh =  smeshBuilder.New()
13 import salome_notebook
14
15 # set variables
16 notebook = salome_notebook.notebook
17 notebook.set("Length", 100)
18 notebook.set("Width", 200)
19 notebook.set("Offset", 50)
20
21 notebook.set("NbSegments", 7)
22 notebook.set("MaxElementArea", 800)
23 notebook.set("MaxElementVolume", 900)
24
25 # create a box
26 box = geompy.MakeBoxDXDYDZ("Length", "Width", 300)
27 idbox = geompy.addToStudy(box, "Box")
28
29 # create a mesh
30 tetra = smesh.Mesh(box, "MeshBox")
31
32 algo1D = tetra.Segment()
33 algo1D.NumberOfSegments("NbSegments")
34
35 algo2D = tetra.Triangle()
36 algo2D.MaxElementArea("MaxElementArea")
37
38 algo3D = tetra.Tetrahedron()
39 algo3D.MaxElementVolume("MaxElementVolume")
40
41 # compute the mesh
42 ret = tetra.Compute()
43
44 # translate the mesh
45 point = SMESH.PointStruct("Offset", 0., 0.)
46 vector = SMESH.DirStruct(point)
47 tetra.TranslateObject(tetra, vector, 0)