Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/hexablock.git] / src / TEST_PY / recettes / cuve.py
1 # -*- coding: latin-1 -*-
2 # Copyright (C) 2009-2012  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # Francis KLOSS - 2011-2012 - CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France
22 # =============================================================================================
23
24 import math
25
26 import geompy
27 import hexablock
28
29 # Charger la géométrie
30 # ====================
31
32 nom = "cuve"
33
34 cuve = geompy.ImportBREP(nom+".brep")
35
36 # Sélectionner des sommets de la géométrie
37 # -----------------------------------------
38
39 sommets = geompy.SubShapeAllSortedCentres(cuve, geompy.ShapeType["VERTEX"])
40
41 coin_a = sommets[ 4]
42 coin_b = sommets[43]
43 coin_c = sommets[62]
44 coin_d = sommets[15]
45
46 support_a_o = sommets[ 3]
47 support_a_x = sommets[ 8]
48 support_a_y = sommets[ 6]
49 support_a_d = sommets[10]
50
51 support_b_o = sommets[42]
52 support_b_x = sommets[36]
53 support_b_y = sommets[47]
54 support_b_d = sommets[38]
55
56 support_c_o = sommets[61]
57 support_c_x = sommets[51]
58 support_c_y = sommets[59]
59 support_c_d = sommets[49]
60
61 support_d_o = sommets[14]
62 support_d_x = sommets[19]
63 support_d_y = sommets[12]
64 support_d_d = sommets[17]
65
66 coin_x1, coin_y1, coin_z1 = geompy.PointCoordinates(sommets[ 2])
67 coin_x2, coin_y2, coin_z2 = geompy.PointCoordinates(support_a_d)
68 coin_x3, coin_y3, coin_z3 = geompy.PointCoordinates(support_a_o)
69 coin_x4, coin_y4, coin_z4 = geompy.PointCoordinates(coin_c)
70
71 base_x, base_y, base_z = geompy.PointCoordinates(sommets[52])
72 oppo_x, oppo_y, oppo_z = geompy.PointCoordinates(sommets[57])
73
74 # Sélectionner des arêtes de la géométrie
75 # ---------------------------------------
76
77 aretes = geompy.SubShapeAllSortedCentres(cuve, geompy.ShapeType["EDGE"])
78
79 interne0, interne_x, interne_y, interne_z,  interne_dx, interne_dy, interne_dz,  interne_rayon = geompy.KindOfShape(aretes[48])
80 externe0, externe_x, externe_y, externe_z,  externe_dx, externe_dy, externe_dz,  externe_rayon = geompy.KindOfShape(aretes[49])
81
82 cote_a = aretes[41]
83 cote_b = aretes[91]
84 cote_c = aretes[59]
85 cote_d = aretes[12]
86
87 piquage_1_int = aretes[  0]
88 piquage_1_ext = aretes[  1]
89 piquage_1_feb = aretes[ 36]
90 piquage_1_feh = aretes[ 38]
91 piquage_1_eeb = aretes[ 33]
92 piquage_1_eeh = aretes[ 37]
93 piquage_1_eib = aretes[ 34]
94 piquage_1_eih = aretes[ 35]
95
96 piquage_2_int = aretes[103]
97 piquage_2_ext = aretes[104]
98 piquage_2_feg = aretes[ 68]
99 piquage_2_fed = aretes[ 73]
100 piquage_2_eeg = aretes[ 79]
101 piquage_2_eed = aretes[ 88]
102 piquage_2_eig = aretes[ 80]
103 piquage_2_eid = aretes[ 89]
104
105 support_l, support_a, support_v = geompy.BasicProperties(aretes[43])
106 cote_lgr, cote_aire, cote_vol   = geompy.BasicProperties(cote_a)
107
108 # Sélectionner des faces de la géométrie
109 # --------------------------------------
110
111 faces = geompy.SubShapeAllSortedCentres(cuve, geompy.ShapeType["FACE"])
112
113 face_cylindrique_int = faces[21]
114 face_cylindrique_ext = faces[22]
115
116 # Construire le modèle de blocs
117 # =============================
118
119 # Créer le document
120 # -----------------
121
122 doc = hexablock.addDocument(nom)
123
124 # Calculer l'angle défini par le centre de la cuve et 2 points (projeté dans le plan XY)
125 # --------------------------------------------------------------------------------------
126
127 centre_cuve = geompy.MakeVertex(externe_x, externe_y, 0)
128
129 def calculer_angle(point1, point2):
130   x1, y1, z1 = geompy.PointCoordinates(point1)
131   x2, y2, z2 = geompy.PointCoordinates(point2)
132
133   p1 = geompy.MakeVertex(x1, y1, 0)
134   p2 = geompy.MakeVertex(x2, y2, 0)
135
136   a1 = geompy.MakeEdge(centre_cuve, p1)
137   a2 = geompy.MakeEdge(centre_cuve, p2)
138
139   return geompy.GetAngle(a1, a2)
140
141 # Construire les 8 points de la grille
142 # ------------------------------------
143
144 p1_int0, p1_int_x, p1_int_y, p1_int_z,  p1_int_dx, p1_int_dy, p1_int_dz,  p1_int_rayon = geompy.KindOfShape(piquage_1_int)
145 p2_int0, p2_int_x, p2_int_y, p2_int_z,  p2_int_dx, p2_int_dy, p2_int_dz,  p2_int_rayon = geompy.KindOfShape(piquage_2_int)
146
147 p1_int_c = geompy.MakeVertex(p1_int_x, p1_int_y, p1_int_z)
148 p2_int_c = geompy.MakeVertex(p2_int_x, p2_int_y, p2_int_z)
149
150 p1_int_e = geompy.MakePrismDXDYDZ2Ways(p1_int_c, p1_int_dx*cote_lgr, p1_int_dy*cote_lgr, p1_int_dz*cote_lgr)
151 p2_int_e = geompy.MakePrismDXDYDZ2Ways(p2_int_c, p2_int_dx*cote_lgr, p2_int_dy*cote_lgr, p2_int_dz*cote_lgr)
152
153 plan_2 = geompy.MakePrismDXDYDZ(p1_int_e, +cote_lgr, +cote_lgr, -cote_lgr)
154 plan_3 = geompy.MakePrismDXDYDZ(p1_int_e, -cote_lgr, -cote_lgr, -cote_lgr)
155
156 plan_7 = geompy.MakePrismDXDYDZ(p2_int_e, 0, -cote_lgr, -cote_lgr)
157 plan_8 = geompy.MakePrismDXDYDZ(p2_int_e, 0, +cote_lgr, -cote_lgr)
158
159 part_2 = geompy.MakePartition([piquage_1_eeb], [plan_2], [], [], geompy.ShapeType["VERTEX"])
160 part_3 = geompy.MakePartition([piquage_1_eeb], [plan_3], [], [], geompy.ShapeType["VERTEX"])
161
162 part_7 = geompy.MakePartition([piquage_2_feg], [plan_7], [], [], geompy.ShapeType["VERTEX"])
163 part_8 = geompy.MakePartition([piquage_2_fed], [plan_8], [], [], geompy.ShapeType["VERTEX"])
164
165 point_1 = coin_c
166 point_2 = geompy.SubShapeAllSortedCentres(part_2, geompy.ShapeType["VERTEX"])[1]
167 point_3 = geompy.SubShapeAllSortedCentres(part_3, geompy.ShapeType["VERTEX"])[1]
168 point_4 = geompy.MakeVertexOnCurve(cote_d, 0.55)
169 point_5 = coin_a
170 point_6 = coin_b
171 point_7 = geompy.SubShapeAllSortedCentres(part_7, geompy.ShapeType["VERTEX"])[0]
172 point_8 = geompy.SubShapeAllSortedCentres(part_8, geompy.ShapeType["VERTEX"])[2]
173
174 # Construire la grille cylindrique
175 # --------------------------------
176
177 grille_hauteur = coin_z4-coin_z2
178
179 centre = doc.addVertex(externe_x, externe_y, externe_z-grille_hauteur)
180
181 grille_x = doc.addVector(1, 1, 0)
182 grille_z = doc.addVector(0, 0, 1)
183
184 petit_rayon = interne_rayon * 0.2
185 grand_rayon = math.sqrt( (coin_x1-externe_x)**2 + (coin_y1-externe_y)**2 )
186
187 rayons = [ petit_rayon, interne_rayon-petit_rayon, externe_rayon-interne_rayon, grand_rayon-externe_rayon ]
188
189 points = [ point_1, point_2, point_3, point_4, point_5, point_6, point_7, point_8, point_1 ]
190
191 angles = []
192 for i in xrange(8):
193   angle = calculer_angle(points[i], points[i+1])
194   angles.append(angle)
195
196 hauteurs = [ grille_hauteur ]
197
198 grille = doc.makeCylindricals(centre, grille_x, grille_z, rayons, angles, hauteurs, False)
199
200 # Ajouter le centre
201 # -----------------
202
203 quad_0 = grille.getQuadJK(0, 7, 0)
204 quad_6 = grille.getQuadJK(0, 0, 0)
205 quad_7 = grille.getQuadJK(0, 1, 0)
206
207 centre_a = doc.addHexa3Quads(quad_0, quad_6, quad_7)
208
209 quad_2 = grille.getQuadJK(0, 3, 0)
210 quad_3 = grille.getQuadJK(0, 4, 0)
211 quad_4 = grille.getQuadJK(0, 5, 0)
212
213 centre_b = doc.addHexa3Quads(quad_2, quad_3, quad_4)
214
215 quad_1 = grille.getQuadJK(0, 2, 0)
216 quad_5 = grille.getQuadJK(0, 6, 0)
217
218 quad_a = centre_a.getQuad(1)
219 quad_b = centre_b.getQuad(1)
220
221 centre_c = doc.addHexa4Quads(quad_1, quad_a, quad_5, quad_b)
222
223 # Ajouter l'enceinte
224 # ------------------
225
226 plan_0  = geompy.MakePrismDXDYDZ(p1_int_e, +cote_lgr, +cote_lgr, +cote_lgr)
227 part_0  = geompy.MakePartition([piquage_1_feh], [plan_0], [], [], geompy.ShapeType["VERTEX"])
228 point_0 = geompy.SubShapeAllSortedCentres(part_0, geompy.ShapeType["VERTEX"])[1]
229
230 enceinte_quads = []
231 for j in xrange(8):
232   q = grille.getQuadIJ(1, j, 1)
233   enceinte_quads.append(q)
234
235 point_7x, point_7y, point_7z = geompy.PointCoordinates(point_7)
236 point_2x, point_2y, point_2z = geompy.PointCoordinates(point_2)
237 point_0x, point_0y, point_0z = geompy.PointCoordinates(point_0)
238
239 enceinte_h1 = point_7z - base_z
240 enceinte_h2 = point_2z - base_z
241 enceinte_h3 = point_0z - base_z
242 enceinte_h4 = oppo_z   - base_z
243
244 enceinte_hauteurs = [ enceinte_h1, enceinte_h2, enceinte_h3, enceinte_h4 ]
245
246 enceinte_pz = doc.addVector(oppo_x - base_x, oppo_y - base_y, enceinte_h4)
247
248 enceinte = doc.prismQuadsVec(enceinte_quads, enceinte_pz, enceinte_hauteurs, 0)
249
250 # Déconnecter via des arêtes, puis prismer, puis compléter (3) ou coller (1)
251 # --------------------------------------------------------------------------
252
253 periph_hexas     = []
254 supports_quads_b = []
255 supports_quads_h = []
256
257 v1 = doc.addVector(   0, +0.1, 0)
258 v2 = doc.addVector(   0, -0.1, 0)
259 v3 = doc.addVector(+0.2, -0.1, 0)
260
261 for j, v in [ [0, v1], [1, v1], [4, v2], [5, v3] ]:
262   h = grille.getHexaIJK(2, j, 0)
263   a = grille.getEdgeK(3, j, 0)
264   d = doc.disconnectEdge(h, a)
265
266   q1 = d.getQuad(0)
267   q2 = grille.getQuadIK(2, j, 0)
268   if j==1:
269     h0 = doc.addHexa2Quads(q1, q2)
270     q3 = grille.getQuadJK(3, j, 0)
271     q4 = h0.getQuad(3)
272     h1 = doc.addHexa2Quads(q3, q4)
273     qb = h1.getQuad(hexablock.Q_E)
274     qh = h1.getQuad(hexablock.Q_F)
275   else:
276     p = doc.prismQuad(q1, v, 2)
277
278     h0 = p.getHexa(0)
279     q3 = h0.getQuad(5)
280     h1 = p.getHexa(1)
281     q4 = h1.getQuad(5)
282     doc.addHexa3Quads(q2, q3, q4)
283     periph_hexas.append(h0)
284     qb = h1.getQuad(hexablock.Q_C)
285     qh = h1.getQuad(hexablock.Q_D)
286
287   supports_quads_b.append(qb)
288   supports_quads_h.append(qh)
289
290 # Piquer les 2 tuyaux sur l'enceinte
291 # ----------------------------------
292
293 piquage_centre = doc.addVertex(10, 0, 0)
294
295 piquage_vx = doc.addVector(1, 0, 0)
296 piquage_vz = doc.addVector(0, 0, 1)
297
298 piquage = doc.makeCylindrical(piquage_centre, piquage_vx, piquage_vz,  1, 360, 1,  1, 4, 1,  False)
299
300 piquage_quads = [ piquage.getQuadIJ(0, j, 0) for j in xrange(4) ]
301
302 piquage_s1 = piquage.getVertexIJK(1, 0, 0)
303 piquage_s2 = piquage.getVertexIJK(1, 1, 0)
304 piquage_s3 = piquage.getVertexIJK(1, 2, 0)
305
306 enceinte_ha = enceinte.getHexa( 6)
307 enceinte_hb = enceinte.getHexa(25)
308
309 enceinte_s11 = enceinte_ha.getVertex(2)
310 enceinte_s12 = enceinte_ha.getVertex(3)
311 enceinte_s13 = enceinte_ha.getVertex(7)
312
313 enceinte_s21 = enceinte_hb.getVertex(2)
314 enceinte_s22 = enceinte_hb.getVertex(3)
315 enceinte_s23 = enceinte_hb.getVertex(7)
316
317 piquage_1 = doc.replace(piquage_quads, piquage_s1, enceinte_s11, piquage_s2, enceinte_s12, piquage_s3, enceinte_s13)
318 piquage_2 = doc.replace(piquage_quads, piquage_s1, enceinte_s21, piquage_s2, enceinte_s22, piquage_s3, enceinte_s23)
319
320 # Nettoyer le template du piquage
321 # -------------------------------
322
323 doc.removeElements(piquage)
324
325 # Associer le modèle de blocs avec la géométrie
326 # =============================================
327
328 doc.setShape(cuve)
329
330 # Nettoyer les associations implicites du centre et de la périphérie
331 # ------------------------------------------------------------------
332
333 for i in xrange(0, 4, 3):
334   for j in xrange(8):
335     for k in xrange(2):
336       e = grille.getEdgeJ(i, j, k)
337       e.clearAssociation()
338
339 # Associer le centre de l'enceinte
340 # --------------------------------
341
342 for j, ig in [ [2, 30], [3, 28], [6, 32], [7, 34] ]:
343   sm0 = grille.getVertexIJK(0, j, 0)
344   sg0 = sommets[ig]
345   sm0.setAssociation(sg0)
346
347   sm1 = grille.getVertexIJK(0, j, 1)
348   sg1 = geompy.MakeTranslation(sg0, 0, 0, grille_hauteur)
349   sm1.setAssociation(sg1)
350
351 for j, ig, sens in [ [0, 34, +1], [1, 30, +1], [4, 28, -1], [5, 32, -1] ]:
352   sm0 = grille.getVertexIJK(0, j, 0)
353   sg0 = geompy.MakeTranslation(sommets[ig], 0, sens*support_l, 0)
354   sm0.setAssociation(sg0)
355
356   sm1 = grille.getVertexIJK(0, j, 1)
357   sg1 = geompy.MakeTranslation(sg0, 0, 0, grille_hauteur)
358   sm1.setAssociation(sg1)
359
360 # Associer les 16 sommets des 4 supports externes
361 # -----------------------------------------------
362
363 supports_points = [
364   [ support_c_o, support_c_y, support_c_d, support_c_x ],
365   [ support_d_d, support_d_y, support_d_o, support_d_x ],
366   [ support_a_o, support_a_y, support_a_d, support_a_x ],
367   [ support_b_o, support_b_x, support_b_d, support_b_y ]
368 ]
369
370 for s in xrange(4):
371   qb = supports_quads_b[s]
372   qh = supports_quads_h[s]
373   cs = supports_points[s]
374   for i in xrange(4):
375     smb = qb.getVertex(i)
376     sgb = cs[i]
377     smb.setAssociation(sgb)
378
379     if s==1:
380       ind = i
381     else:
382       ind = [1, 0, 3, 2][i]
383     smh = qh.getVertex(ind)
384     sgh = geompy.MakeTranslation(sgb, 0, 0, grille_hauteur)
385     smh.setAssociation(sgh)
386
387 # Associer les 7 sommets périphériques de la grille
388 # -------------------------------------------------
389
390 par_1 = 0.17
391 par_2 = 1 - par_1
392
393 periph_grille = [ [0, cote_b, par_2], [1, cote_c, 0.22], [3, cote_d, 0.548], [4, cote_d, par_1], [5, cote_a, par_2], [6, cote_b, 0.44], [7, cote_b, 0.555] ]
394
395 for j, ag, p in periph_grille:
396   smb = grille.getVertexIJK(3, j, 1)
397   sgb = geompy.MakeVertexOnCurve(ag, p)
398   smb.setAssociation(sgb)
399
400   smh = grille.getVertexIJK(3, j, 0)
401   sgh = geompy.MakeTranslation(sgb, 0, 0, -grille_hauteur)
402   smh.setAssociation(sgh)
403
404 # Associer les 3 sommets liés aux déconnections sur la grille
405 # -----------------------------------------------------------
406
407 periph_deco = [ [cote_c, par_2], [cote_a, par_1], [cote_b, par_1] ]
408
409 for i in xrange(3):
410   hxa = periph_hexas[i]
411   ag, p = periph_deco[i]
412   smb = hxa.getVertex(2)
413   sgb = geompy.MakeVertexOnCurve(ag, p)
414   smb.setAssociation(sgb)
415
416   smh = hxa.getVertex(0)
417   sgh = geompy.MakeTranslation(sgb, 0, 0, -grille_hauteur)
418   smh.setAssociation(sgh)
419
420 # Réparer les piquages
421 # --------------------
422
423 piquage_e_base  = geompy.MakeVertex(interne_x, interne_y, interne_z)
424 piquage_e_axe   = geompy.MakeVectorDXDYDZ(interne_dx, interne_dy, interne_dz)
425 piquage_e_cyl   = geompy.MakeCylinder(piquage_e_base, piquage_e_axe, interne_rayon, enceinte_h4)
426
427 piquage_1_axe   = geompy.MakeVectorDXDYDZ(p1_int_dx, p1_int_dy, p1_int_dz)
428 piquage_1_cyl   = geompy.MakeCylinder(p1_int_c, piquage_1_axe, p1_int_rayon, cote_lgr)
429
430 piquage_2_axe   = geompy.MakeVectorDXDYDZ(p2_int_dx, p2_int_dy, p2_int_dz)
431 piquage_2_cyl   = geompy.MakeCylinder(p2_int_c, piquage_2_axe, p2_int_rayon, cote_lgr)
432
433 piquage_1_inter = geompy.SubShapeAllSortedCentres(geompy.MakeSection(piquage_e_cyl, piquage_1_cyl), geompy.ShapeType["EDGE"])
434 piquage_2_inter = geompy.SubShapeAllSortedCentres(geompy.MakeSection(piquage_e_cyl, piquage_2_cyl), geompy.ShapeType["EDGE"])
435
436 piquage_1_fi  = piquage_1_inter[0]
437
438 piquage_2_fig = piquage_2_inter[0]
439 piquage_2_fid = piquage_2_inter[1]
440
441 # Associer les piquages
442 # ---------------------
443
444 piquages_devant = [
445   [ piquage_1, piquage_1_int, 0.375, piquage_1_ext, 0.125 ],
446   [ piquage_2, piquage_2_int, 0.125, piquage_2_ext, 0.875 ]
447 ]
448
449 for m_piq, a_int, p_int, a_ext, p_ext in piquages_devant:
450
451   i1 = m_piq.getEdge(2)
452   i2 = m_piq.getEdge(5)
453   i3 = m_piq.getEdge(7)
454   i4 = m_piq.getEdge(10)
455
456   doc.associateClosedLine(i1.getVertex(1), i1, [ i2, i3, i4 ], a_int, p_int, True, [])
457
458   e1 = m_piq.getEdge(0)
459   e2 = m_piq.getEdge(1)
460   e3 = m_piq.getEdge(9)
461   e4 = m_piq.getEdge(11)
462
463   doc.associateClosedLine(e1.getVertex(0), e1, [ e2, e3, e4 ], a_ext, p_ext, False, [])
464
465 piquages_milieu = [
466   [ piquage_1, piquage_1_eib, piquage_1_eih, 0.30, piquage_1_eeb, piquage_1_eeh, 0.30 ],
467   [ piquage_2, piquage_2_eid, piquage_2_eig, 0.75, piquage_2_eed, piquage_2_eeg, 0.75 ]
468 ]
469
470 for m_piq, a_int1, a_int2, p_int, a_ext1, a_ext2, p_ext in piquages_milieu:
471
472   i1 = m_piq.getEdge(22)
473   i2 = m_piq.getEdge(25)
474   i3 = m_piq.getEdge(27)
475   i4 = m_piq.getEdge(30)
476
477   doc.associateClosedLine(i1.getVertex(0), i1, [ i4, i3, i2 ], a_int1, p_int, False, [a_int2])
478
479   e1 = m_piq.getEdge(20)
480   e2 = m_piq.getEdge(21)
481   e3 = m_piq.getEdge(29)
482   e4 = m_piq.getEdge(31)
483
484   doc.associateClosedLine(e1.getVertex(0), e1, [ e2, e3, e4 ], a_ext1, p_ext, False, [a_ext2])
485
486 piquages_fond = [
487   [ piquage_1, piquage_1_fi , []             , 0.125, piquage_1_feb, piquage_1_feh, 0.30 ],
488   [ piquage_2, piquage_2_fid, [piquage_2_fig], 0.75 , piquage_2_fed, piquage_2_feg, 0.75 ]
489 ]
490
491 for m_piq, a_int1, a_int2, p_int, a_ext1, a_ext2, p_ext in piquages_fond:
492
493   i1 = m_piq.getEdge(42)
494   i2 = m_piq.getEdge(45)
495   i3 = m_piq.getEdge(47)
496   i4 = m_piq.getEdge(50)
497
498   doc.associateClosedLine(i1.getVertex(0), i1, [ i4, i3, i2 ], a_int1, p_int, False, a_int2)
499
500   e1 = m_piq.getEdge(40)
501   e2 = m_piq.getEdge(41)
502   e3 = m_piq.getEdge(49)
503   e4 = m_piq.getEdge(51)
504
505   doc.associateClosedLine(e1.getVertex(1), e1, [ e2, e3, e4 ], a_ext1, p_ext, False, [a_ext2])
506
507 # Associer quelques faces
508 # -----------------------
509
510 for h in [ 2, 5, 7, 10,  21, 24, 26, 29 ]:
511   enceinte_hc = enceinte.getHexa(h)
512
513   enceinte_qc = enceinte_hc.getQuad(hexablock.Q_C)
514   enceinte_qc.addAssociation(face_cylindrique_int)
515
516   enceinte_qc = enceinte_hc.getQuad(hexablock.Q_D)
517   enceinte_qc.addAssociation(face_cylindrique_ext)
518
519 # Primer les 5 supports (finalisation du modèle de blocs)
520 # -------------------------------------------------------
521
522 supports_quads_b.append( centre_c.getQuad(hexablock.Q_E) )
523
524 supports_z = doc.addVector(coin_x1 - coin_x3, coin_y1 - coin_y3, coin_z1 - coin_z3)
525
526 supports = doc.prismQuads(supports_quads_b, supports_z, 1)
527
528 # Mailler le modèle de blocs
529 # ==========================
530
531 # Définir les groupes volumiques
532 # ------------------------------
533
534 groupe_fd = doc.addHexaGroup("fond")
535 groupe_en = doc.addHexaGroup("enceinte")
536 groupe_p1 = doc.addHexaGroup("piquage:1")
537 groupe_p2 = doc.addHexaGroup("piquage:2")
538 groupe_su = doc.addHexaGroup("supports")
539
540 for i in xrange( doc.countUsedHexa() ):
541   h = doc.getUsedHexa(i)
542   groupe_fd.addElement(h)
543
544 for i in xrange( enceinte.countHexa() ):
545   h = enceinte.getHexa(i)
546   if h != None:
547     groupe_en.addElement(h)
548     groupe_fd.removeElement(h)
549
550 for i in xrange( piquage_1.countHexa() ):
551   h = piquage_1.getHexa(i)
552   groupe_p1.addElement(h)
553   groupe_fd.removeElement(h)
554
555 for i in xrange( piquage_2.countHexa() ):
556   h = piquage_2.getHexa(i)
557   groupe_p2.addElement(h)
558   groupe_fd.removeElement(h)
559
560 for i in xrange( supports.countHexa() ):
561   h = supports.getHexa(i)
562   groupe_su.addElement(h)
563   groupe_fd.removeElement(h)
564
565 # Générer le maillage
566 # -------------------
567
568 hexablock.addLaws(doc, 0.015, False)
569
570 maillage = hexablock.mesh(doc)
571
572 muv, mue, muq, muh = hexablock.dump(doc, maillage)