Salome HOME
0023591: [EDF] Add test to check meshing plug-ins to SMESH module
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex03.py
1 # Start and End Length
2
3 import salome
4 salome.salome_init()
5 import GEOM
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
8
9 import SMESH, SALOMEDS
10 from salome.smesh import smeshBuilder
11 smesh =  smeshBuilder.New()
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 an edge in a fixed number of segments
31 algo1D.NumberOfSegments(4)
32
33 # create a local hypothesis
34 algo_local = hexa.Segment(EdgeX)
35
36 # define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
37 algo_local.StartEndLength(1, 6)
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()