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