Salome HOME
03c56d512896193020ca9dcad653970b571d3408
[modules/hexablock.git] / doc / pyplots / test_make_cyl_grid.py
1 # Copyright (C) 2009-2023  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 #
21
22 import os
23 import GEOM
24 import SALOMEDS
25 import hexablock
26
27 # differents cas possibles de remplissage possibles :
28
29
30 print("test grille cylindrique...")
31 doc = hexablock.addDocument()
32
33 orig1 = doc.addVertex(0, 0, 0)
34 orig2 = doc.addVertex(10, 0, 0)
35 orig3 = doc.addVertex(0, 10, 0)
36 orig4 = doc.addVertex(10, 10, 0)
37 orig5 = doc.addVertex(0, 20, 0)
38 orig6 = doc.addVertex(10, 20, 0)
39
40 vz = doc.addVector(0, 0, 1)
41 vx = doc.addVector(1, 0, 0)
42
43 dr = 1
44 dl = 1
45 nr = 2
46 nl = 3
47
48 c1 = doc.makeCylindrical(orig1, vx, vz, dr, 360, dl, nr, 4, nl, True)
49 c2 = doc.makeCylindrical(orig2, vx, vz, dr, 360, dl, nr, 8, nl, True)
50 c3 = doc.makeCylindrical(orig3, vx, vz, dr, 270, dl, nr, 8, nl, True)
51 c4 = doc.makeCylindrical(orig4, vx, vz, dr, 270, dl, nr, 7, nl, True)
52 c5 = doc.makeCylindrical(orig5, vx, vz, dr, 360, dl, nr, 5, nl, True)
53 c6 = doc.makeCylindrical(orig6, vx, vz, dr, 360, dl, nr, 6, nl, True)
54
55 base2 = nr * nl * 8
56 for i in range(2):
57     c2.getHexa(base2 + i).setScalar(5)
58
59 file_name = os.path.join(os.environ['TMP'], 'grilles_cylindriques.vtk')
60 ####  doc.saveVtk(file_name)
61
62 print("...test grille cylindrique OK")
63
64