Salome HOME
CMake:
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex01.py
1 # Arithmetic 1D
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 # optionally reverse node distribution on certain edges
24 allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
25 reversedEdges = [ allEdges[0], allEdges[4] ]
26
27 # define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length 
28 algo1D.Arithmetic1D(1, 4, reversedEdges)
29
30 # create a quadrangle 2D algorithm for faces
31 hexa.Quadrangle()
32
33 # create a hexahedron 3D algorithm for solids
34 hexa.Hexahedron()
35
36 # compute the mesh
37 hexa.Compute()