Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / doc / salome / examples / creating_meshes_ex02.py
1 # Construction of a Submesh
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 # select one edge of the box for definition of a local hypothesis
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 quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
17
18 # create a regular 1D algorithm for the faces
19 algo1D = quadra.Segment()
20
21 # define "NumberOfSegments" hypothesis to cut
22 # all the edges in a fixed number of segments
23 algo1D.NumberOfSegments(4)
24
25 # create a quadrangle 2D algorithm for the faces
26 quadra.Quadrangle()
27
28 # construct a submesh on the edge with a local hypothesis
29 algo_local = quadra.Segment(EdgeX)
30
31 # define "Arithmetic1D" hypothesis to cut the edge in several segments with increasing arithmetic length
32 algo_local.Arithmetic1D(1, 4)
33
34 # define "Propagation" hypothesis that propagates all other hypotheses
35 # on all edges of the opposite side in case of quadrangular faces
36 algo_local.Propagation()
37
38 # compute the mesh
39 quadra.Compute()