Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / defining_hypotheses_ex04.py
1 # Local Length
2
3 import salome
4 salome.salome_init_without_session()
5
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
8
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
11
12 # create a box
13 box = geom_builder.MakeBoxDXDYDZ(10., 10., 10.)
14 geom_builder.addToStudy(box, "Box")
15
16 # get one edge of the box to put local hypothesis on
17 p5 = geom_builder.MakeVertex(5., 0., 0.)
18 EdgeX = geom_builder.GetEdgeNearPoint(box, p5)
19 geom_builder.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
20
21 # create a hexahedral mesh on the box
22 hexa = smesh_builder.Mesh(box, "Box : hexahedrical mesh")
23
24 # set algorithms
25 algo1D = hexa.Segment()
26 hexa.Quadrangle()
27 hexa.Hexahedron()
28
29 # define "NumberOfSegments" hypothesis to cut all edges in a fixed number of segments
30 algo1D.NumberOfSegments(4)
31
32 # create a sub-mesh
33 algo_local = hexa.Segment(EdgeX)
34
35 # define "LocalLength" hypothesis to cut an edge in several segments with the same length
36 algo_local.LocalLength(2.)
37
38 # define "Propagation" hypothesis that propagates all other hypothesis
39 # on all edges on the opposite side in case of quadrangular faces
40 algo_local.Propagation()
41
42 # compute the mesh
43 hexa.Compute()