Salome HOME
Redesign SALOME documentation
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex04.py
1 # Local Length
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 # get one edge of the box to put local hypothesis on
18 p5 = geompy.MakeVertex(5., 0., 0.)
19 EdgeX = geompy.GetEdgeNearPoint(box, p5)
20 geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
21
22 # create a hexahedral mesh on the box
23 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
24
25 # set algorithms
26 algo1D = hexa.Segment()
27 hexa.Quadrangle()
28 hexa.Hexahedron()
29
30 # define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
31 algo1D.NumberOfSegments(4)
32
33 # create a sub-mesh
34 algo_local = hexa.Segment(EdgeX)
35
36 # define "LocalLength" hypothesis to cut an edge in several segments with the same length
37 algo_local.LocalLength(2.)
38
39 # define "Propagation" hypothesis that propagates all other hypothesis
40 # on all edges on the opposite side in case of quadrangular faces
41 algo_local.Propagation()
42
43 # compute the mesh
44 hexa.Compute()