Salome HOME
0023580: [EDF] AsterStudy: more distinct display of selected items in 3D view
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex09.py
1 # Defining Meshing Algorithms
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.MakeBoxDXDYDZ(10., 10., 10.)
15 geompy.addToStudy(box, "Box")
16
17 # Create a hexahedral mesh on the box
18 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
19
20 # create a Regular 1D algorithm for edges
21 algo1D = hexa.Segment()
22
23 # create a quadrangle 2D algorithm for faces
24 algo2D = hexa.Quadrangle()
25
26 # create a hexahedron 3D algorithm for solids
27 algo3D = hexa.Hexahedron()
28
29 # define hypotheses
30 algo1D.Arithmetic1D(1, 4)
31
32 # compute the mesh
33 hexa.Compute()
34
35 # 2. Create a tetrahedral mesh on the box
36 tetra = smesh.Mesh(box, "Box : tetrahedrical mesh")
37
38 # create a Regular 1D algorithm for edges
39 algo1D = tetra.Segment()
40
41 # create a Mefisto 2D algorithm for faces
42 algo2D = tetra.Triangle()
43
44 # create a 3D algorithm for solids
45 algo3D = tetra.Tetrahedron()
46
47 # define hypotheses
48 algo1D.Arithmetic1D(1, 4)
49 algo2D.LengthFromEdges()
50
51 # compute the mesh
52 tetra.Compute()