Salome HOME
Merge from V6_main 11/02/2013
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex03.py
1 # Start and End Length
2
3 from geompy import *
4 import smesh
5
6 # create a box
7 box = MakeBoxDXDYDZ(10., 10., 10.)
8 addToStudy(box, "Box")
9
10 # get one edge of the box to put local hypothesis on
11 p5 = MakeVertex(5., 0., 0.)
12 EdgeX = GetEdgeNearPoint(box, p5)
13 addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
14
15 # create a hexahedral mesh on the box
16 hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
17
18 # set algorithms
19 algo1D = hexa.Segment()
20 hexa.Quadrangle()
21 hexa.Hexahedron()
22
23 # define "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
24 algo1D.NumberOfSegments(4)
25
26 # create a local hypothesis
27 algo_local = hexa.Segment(EdgeX)
28
29 # define "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
30 algo_local.StartEndLength(1, 6)
31
32 # define "Propagation" hypothesis that propagates all other hypothesis
33 # on all edges on the opposite side in case of quadrangular faces
34 algo_local.Propagation()
35
36 # compute the mesh
37 hexa.Compute()