Salome HOME
16442d585dc03e43828be4880cbc9ed1360d27f7
[modules/hexablock.git] / src / TEST_PY / test_v6 / test_cone.py
1 # -*- coding: latin-1 -*-
2 # Hexa : Creation d'hexaedres 
3
4 # Copyright (C) 2009-2023  CEA, EDF
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 import hexablock
24 ###  import os
25 ###  import geompy
26 geompy = hexablock.geompy
27
28 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
29
30
31 doc  = hexablock.addDocument ("test_cone")
32
33 orig = doc.addVertex (0, 0, 0)
34 ori2 = doc.addVertex (0, 0, 10)
35 vz   = doc.addVector (0, 0, 1)
36 vx   = doc.addVector (1 ,0, 0)
37
38 rad1   = 4.0
39 rad2   = 2.0
40 height = 5.0
41 angle  = 270.0
42 hollow = False
43
44 nr = 2
45 na = 8
46 nl = 1
47
48 c1 = doc.makePipeUni (orig, vx,vz, rad1/2, rad1, angle, height, nr,na,nl)
49 c2 = doc.makePipeUni (ori2, vx,vz, rad2/2, rad2, angle, height, nr,na,nl)
50
51              ### -------- We prepare a joint ....
52 vh0 = c2.getVertexIJK (0, 0, 0)
53 vh1 = c2.getVertexIJK (1, 0, 0)
54
55 vb0 = c1.getVertexIJK (0, 0, nl)
56 vb1 = c1.getVertexIJK (1, 0, nl)
57
58 qcible = c2.getQuadIJ (0, 0, 0)
59 qliste = []
60 for ni in range (nr) :
61     for nj in range (na) :
62         quad = c1.getQuadIJ (ni, nj, nl)
63         qliste.append (quad)
64
65              ### -------- Join quads to make a cone between the 2 cylinders
66 doc.joinQuadsUni  (qliste, qcible, vb0, vh0, vb1, vh1, 1)
67
68              ### -------------------- Mesh 
69
70 doc.save ("test_cones")
71
72 law = doc.addLaw ("Uniform", 4)
73
74 for np in range(doc.countPropagation()):
75     propa = doc.getPropagation (np)
76     propa.setLaw (law) 
77
78 mesh_hexas = hexablock.mesh(doc)
79