Salome HOME
Préparation pour MG-CADSurf
[modules/smesh.git] / src / Tools / blocFissure / CasTests / fissure_Coude.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020  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, or (at your option) any later version.
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 import os
22
23 from blocFissure import gmu
24 from blocFissure.gmu.geomsmesh import geompy, smesh
25
26 import math
27 import GEOM
28 import SALOMEDS
29 import SMESH
30 #import StdMeshers
31 #import GHS3DPlugin
32 #import NETGENPlugin
33 import logging
34
35 from blocFissure.gmu.fissureGenerique import fissureGenerique
36
37 from blocFissure.gmu.triedreBase import triedreBase
38 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
39 from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
40 from blocFissure.gmu.insereFissureLongue import insereFissureLongue
41
42 O, OX, OY, OZ = triedreBase()
43
44 class fissure_Coude(fissureGenerique):
45   """problème de fissure du Coude : version de base
46
47   maillage hexa
48   """
49
50   nomProbleme = "fissure_Coude"
51
52   # ---------------------------------------------------------------------------
53   def setParamGeometrieSaine(self):
54     """
55     Paramètres géométriques du tuyau coudé sain:
56     angleCoude
57     r_cintr
58     l_tube_p1
59     l_tube_p2
60     epais
61     de
62     """
63     self.geomParams = dict(angleCoude = 60,
64                            r_cintr    = 1200,
65                            l_tube_p1  = 1600,
66                            l_tube_p2  = 1200,
67                            epais      = 40,
68                            de         = 760)
69
70   # ---------------------------------------------------------------------------
71   def genereGeometrieSaine(self, geomParams):
72     logging.info("genereGeometrieSaine %s", self.nomCas)
73
74     angleCoude = geomParams['angleCoude']
75     r_cintr    = geomParams['r_cintr']
76     l_tube_p1  = geomParams['l_tube_p1']
77     l_tube_p2  = geomParams['l_tube_p2']
78     epais      = geomParams['epais']
79     de         = geomParams['de']
80
81     centre = geompy.MakeVertex(0, 0, -l_tube_p1)
82     Disk_1 = geompy.MakeDiskPntVecR(centre, OZ, de/2.)
83     Disk_2 = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais)
84     Cut_1 = geompy.MakeCut(Disk_1, Disk_2)
85     Extrusion_1 = geompy.MakePrismVecH(Cut_1, OZ, l_tube_p1)
86     axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
87     Revolution_1 = geompy.MakeRevolution(Cut_1, axe, angleCoude*math.pi/180.0)
88     Rotation_1 = geompy.MakeRotation(Cut_1, axe, angleCoude*math.pi/180.0)
89     Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
90     Extrusion_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
91     Plane_1 = geompy.MakePlaneLCS(None, 100000, 3)
92     geompy.addToStudy( Plane_1, "Plane_1" )
93     geompy.addToStudy( Extrusion_1, "Extrusion_1" )
94     geompy.addToStudy( Revolution_1, "Revolution_1" )
95     geompy.addToStudy( Extrusion_2, "Extrusion_2" )
96
97     P1 = O
98     geompy.addToStudy( P1, "P1" )
99     op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
100     P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
101     P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
102     geompy.addToStudy( P2, "P2" )
103
104     # --- tube coude sain
105
106     geometrieSaine = geompy.MakePartition([Extrusion_1, Revolution_1, Extrusion_2, P1, P2], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
107     geompy.addToStudy( geometrieSaine, self.nomCas )
108     [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
109
110     [ep, circ_g, circ_d, long_p2, long_coude, long_p1] = geompy.Propagate(geometrieSaine)
111     geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' )
112     geompy.addToStudyInFather( geometrieSaine, ep, 'ep' )
113     geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' )
114     geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' )
115     geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' )
116     geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' )
117
118     # --- face extremite tube (EXTUBE)
119
120     facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
121     EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
122     geompy.UnionIDs(EXTUBE, facesIds)
123     geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' )
124
125     # --- edge bord extremite tube (BORDTU)
126
127     edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON)
128     edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2., GEOM.ST_ON)
129     edgesIds = []
130     for edge in edge1Ids:
131       if edge in edge2Ids:
132         edgesIds.append(edge)
133     BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
134     geompy.UnionIDs(BORDTU, edgesIds)
135     geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' )
136
137     # --- face origine tube (CLGV)
138
139     pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
140     vec2 = geompy.MakeVector(P2, pp2)
141     #geompy.addToStudy(vec2, 'vec2')
142     facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
143     CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
144     geompy.UnionIDs(CLGV, facesIds)
145     geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' )
146
147     # --- peau tube interieur (PEAUINT)
148
149     extru1 = geompy.MakePrismVecH(Disk_2, OZ, l_tube_p1)
150     revol1 = geompy.MakeRevolution(Disk_2, axe, angleCoude*math.pi/180.0)
151     rot1 = geompy.MakeRotation(Disk_2, axe, angleCoude*math.pi/180.0)
152     extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
153     interne = geompy.MakeFuse(extru1, revol1)
154     interne = geompy.MakeFuse(extru2, interne)
155     geompy.addToStudy(interne, 'interne')
156     facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
157     PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
158     geompy.UnionIDs(PEAUINT, facesIds)
159     geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' )
160
161     # --- peau tube exterieur (PEAUEXT)
162
163     Disk_3 = geompy.MakeDiskPntVecR(centre, OZ, de/2. +epais)
164     couronne1 = geompy.MakeCut(Disk_3, Disk_1)
165     extru1 = geompy.MakePrismVecH(couronne1, OZ, l_tube_p1)
166     revol1 = geompy.MakeRevolution(couronne1, axe, angleCoude*math.pi/180.0)
167     rot1 = geompy.MakeRotation(couronne1, axe, angleCoude*math.pi/180.0)
168     extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
169     externe = geompy.MakeFuse(extru1, revol1)
170     externe = geompy.MakeFuse(extru2, externe)
171     geompy.addToStudy(externe, 'externe')
172     facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
173     PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
174     geompy.UnionIDs(PEAUEXT, facesIds)
175     geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' )
176
177     # --- solide sain
178
179     volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
180     COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
181     geompy.UnionIDs(COUDE, volIds)
182     geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' )
183
184     geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
185
186     return geometriesSaines
187
188   # ---------------------------------------------------------------------------
189   def setParamMaillageSain(self):
190     self.meshParams = dict(n_long_p1    = 16,
191                            n_ep         = 3,
192                            n_long_coude = 15,
193                            n_circ_g     = 20,
194                            n_circ_d     = 20,
195                            n_long_p2    = 12)
196
197   # ---------------------------------------------------------------------------
198   def genereMaillageSain(self, geometriesSaines, meshParams):
199     logging.info("genereMaillageSain %s", self.nomCas)
200
201     geometrieSaine = geometriesSaines[0]
202     long_p1        = geometriesSaines[1]
203     ep             = geometriesSaines[2]
204     long_coude     = geometriesSaines[3]
205     circ_g         = geometriesSaines[4]
206     circ_d         = geometriesSaines[5]
207     long_p2        = geometriesSaines[6]
208     P1             = geometriesSaines[7]
209     P2             = geometriesSaines[8]
210     EXTUBE         = geometriesSaines[9]
211     BORDTU         = geometriesSaines[10]
212     CLGV           = geometriesSaines[11]
213     PEAUINT        = geometriesSaines[12]
214     PEAUEXT        = geometriesSaines[13]
215     COUDE          = geometriesSaines[14]
216
217     n_long_p1    = meshParams['n_long_p1']
218     n_ep         = meshParams['n_ep']
219     n_long_coude = meshParams['n_long_coude']
220     n_circ_g     = meshParams['n_circ_g']
221     n_circ_d     = meshParams['n_circ_d']
222     n_long_p2    = meshParams['n_long_p2']
223
224     maillageSain = smesh.Mesh(geometrieSaine)
225
226     algo3d = maillageSain.Hexahedron()
227     algo2d = maillageSain.Quadrangle()
228     smesh.SetName(algo3d, "algo3d_maillageSain")
229     smesh.SetName(algo2d, "algo2d_maillageSain")
230
231     algo1d_long_p1 = maillageSain.Segment(geom=long_p1)
232     hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1)
233     smesh.SetName(algo1d_long_p1, "algo1d_long_p1")
234     smesh.SetName(hypo1d_long_p1, "hypo1d_long_p1")
235
236     algo1d_ep = maillageSain.Segment(geom=ep)
237     hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep)
238     smesh.SetName(algo1d_ep, "algo1d_ep")
239     smesh.SetName(hypo1d_ep, "hypo1d_ep")
240
241     algo1d_long_coude = maillageSain.Segment(geom=long_coude)
242     hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude)
243     smesh.SetName(algo1d_long_coude, "algo1d_long_coude")
244     smesh.SetName(hypo1d_long_coude, "hypo1d_long_coude")
245
246     algo1d_circ_g = maillageSain.Segment(geom=circ_g)
247     hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g)
248     smesh.SetName(algo1d_circ_g, "algo1d_circ_g")
249     smesh.SetName(hypo1d_circ_g, "hypo1d_circ_g")
250
251     algo1d_circ_d = maillageSain.Segment(geom=circ_d)
252     hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d)
253     smesh.SetName(algo1d_circ_d, "algo1d_circ_d")
254     smesh.SetName(hypo1d_circ_d, "hypo1d_circ_d")
255
256     algo1d_long_p2 = maillageSain.Segment(geom=long_p2)
257     hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2)
258     smesh.SetName(algo1d_long_p2, "algo1d_long_p2")
259     smesh.SetName(hypo1d_long_p2, "hypo1d_long_p2")
260
261     _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
262     _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
263     _ = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
264     _ = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
265     _ = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
266     _ = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
267     _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
268     _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
269
270     isDone = maillageSain.Compute()
271
272     return [maillageSain, True] # True : maillage hexa
273
274   # ---------------------------------------------------------------------------
275   def setParamShapeFissure(self):
276     """
277     paramètres de la fissure
278     profondeur  : 0 < profondeur <= épaisseur
279     azimut      : entre 0 et 360°
280     alpha       : 0 < alpha < angleCoude
281     longueur    : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue
282     lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
283     orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
284     externe     : True : fissure face externe, False : fissure face interne
285     """
286     logging.info("setParamShapeFissure %s", self.nomCas)
287     self.shapeFissureParams = dict(profondeur  = 10,
288                                    azimut      = 160,
289                                    alpha       = 20,
290                                    longueur    = 400,
291                                    orientation = 90,
292                                    lgInfluence = 0,
293                                    elliptique  = False,
294                                    externe     = True)
295
296   # ---------------------------------------------------------------------------
297   def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
298                                 mailleur="MeshGems"):
299     logging.info("genereShapeFissure %s", self.nomCas)
300     logging.info("shapeFissureParams %s", shapeFissureParams)
301
302     angleCoude = geomParams['angleCoude']
303     r_cintr    = geomParams['r_cintr']
304     l_tube_p1  = geomParams['l_tube_p1']
305     l_tube_p2  = geomParams['l_tube_p2']
306     epais      = geomParams['epais']
307     de         = geomParams['de']
308
309     profondeur  = shapeFissureParams['profondeur']
310     azimut      = shapeFissureParams['azimut']
311     alpha       = shapeFissureParams['alpha']
312     longueur    = shapeFissureParams['longueur']
313     orientation = shapeFissureParams['orientation']
314     externe     = shapeFissureParams['externe']
315     lgInfluence = shapeFissureParams['lgInfluence']
316
317     azimut = -azimut # axe inverse / ASCOUF
318     axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
319
320     if not lgInfluence:
321       lgInfluence = profondeur
322
323     if longueur > 2*profondeur:
324       self.fissureLongue=True
325     else:
326       self.fissureLongue=False
327
328     self.circonferentielle = False
329     self.longitudinale = False
330     if self.fissureLongue and (abs(orientation) < 45) :
331       self.longitudinale = True
332     elif self.fissureLongue:
333       self.circonferentielle = True
334
335     if self.circonferentielle:
336       if externe:
337         raybor = de/2.
338         rayint = raybor - profondeur
339         rayext = raybor + profondeur
340       else:
341         rayext = de/2. - epais
342         rayint = raybor + profondeur
343         rayext = raybor - profondeur
344       lgfond = longueur -2*profondeur
345       angle = lgfond/(2*raybor)
346       pb = geompy.MakeVertex(raybor, 0, 0)
347       pi = geompy.MakeVertex(rayint, 0, 0)
348       pe = geompy.MakeVertex(rayext, 0, 0)
349       pl = geompy.MakeVertex(raybor, profondeur, 0)
350       pr = geompy.MakeVertex(raybor, -profondeur, 0)
351       pil = geompy.MakeRotation(pi, OZ, angle)
352       pll = geompy.MakeRotation(pl, OZ, angle)
353       pel = geompy.MakeRotation(pe, OZ, angle)
354       pir = geompy.MakeRotation(pi, OZ, -angle)
355       prr = geompy.MakeRotation(pr, OZ, -angle)
356       per = geompy.MakeRotation(pe, OZ, -angle)
357       arcl = geompy.MakeArc(pil, pll, pel)
358       arcr = geompy.MakeArc(pir, prr, per)
359       arci = geompy.MakeArc(pil, pi, pir)
360       arce = geompy.MakeArc(pel, pe, per)
361       wire0 = geompy.MakeWire([arcr, arci, arcl])
362       cercle0 = geompy.MakeCircle(O, OY, profondeur/4.0)
363       cercle0 = geompy.MakeRotation(cercle0, OY, math.pi/2.0)
364       cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
365       facetube0 = geompy.MakeFaceWires([cercle0], 1)
366       facetubel = geompy.MakeRotation(facetube0, OZ, angle)
367       facetuber = geompy.MakeRotation(facetube0, OZ, -angle)
368       face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
369       plan0 = geompy.MakePlane(O, OZ, 10000)
370       geompy.addToStudy( face0, 'facefissOrig' )
371       face1 = geompy.MakeRotation(face0, OZ, azimut*math.pi/180.)
372       face2 = geompy.MakeTranslation(face1, 0, 0, -l_tube_p1)
373       facefiss = geompy.MakeRotation(face2, axe, alpha*math.pi/180.)
374       geompy.addToStudy( facefiss, 'facefissPlace' )
375       centre = geompy.MakeRotation(pb, OZ, azimut*math.pi/180.)
376       centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
377       centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
378       geompy.addToStudy( centre, 'centrefissPlace' )
379       arcr = geompy.MakeRotation(arcr, OZ, azimut*math.pi/180.)
380       arcr = geompy.MakeTranslation(arcr, 0, 0, -l_tube_p1)
381       arcr = geompy.MakeRotation(arcr, axe, alpha*math.pi/180.)
382       arci = geompy.MakeRotation(arci, OZ, azimut*math.pi/180.)
383       arci = geompy.MakeTranslation(arci, 0, 0, -l_tube_p1)
384       arci = geompy.MakeRotation(arci, axe, alpha*math.pi/180.)
385       arcl = geompy.MakeRotation(arcl, OZ, azimut*math.pi/180.)
386       arcl = geompy.MakeTranslation(arcl, 0, 0, -l_tube_p1)
387       arcl = geompy.MakeRotation(arcl, axe, alpha*math.pi/180.)
388       wiretube = geompy.MakeRotation(wire0, OZ, azimut*math.pi/180.)
389       wiretube = geompy.MakeTranslation(wiretube, 0, 0, -l_tube_p1)
390       wiretube = geompy.MakeRotation(wiretube, axe, alpha*math.pi/180.)
391       geompy.addToStudy(wiretube, 'wiretubePlace' )
392       facetubel = geompy.MakeRotation(facetubel, OZ, azimut*math.pi/180.)
393       facetubel = geompy.MakeTranslation(facetubel, 0, 0, -l_tube_p1)
394       facetubel = geompy.MakeRotation(facetubel, axe, alpha*math.pi/180.)
395       geompy.addToStudy(facetubel, 'facetubeGauche' )
396       facetuber = geompy.MakeRotation(facetuber, OZ, azimut*math.pi/180.)
397       facetuber = geompy.MakeTranslation(facetuber, 0, 0, -l_tube_p1)
398       facetuber = geompy.MakeRotation(facetuber, axe, alpha*math.pi/180.)
399       geompy.addToStudy(facetuber, 'facetubeDroit' )
400       planfiss = geompy.MakeRotation(plan0, OZ, azimut*math.pi/180.)
401       planfiss = geompy.MakeTranslation(planfiss, 0, 0, -l_tube_p1)
402       planfiss = geompy.MakeRotation(planfiss, axe, alpha*math.pi/180.)
403       geompy.addToStudy(planfiss, 'planfissPlace' )
404       pipefissl = geompy.MakePipe(facetubel, arcl)
405       pipefissi = geompy.MakePipe(facetubel, arci)
406       pipefissr = geompy.MakePipe(facetuber, arcr)
407       pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
408       geompy.addToStudy(pipefiss, 'pipefissPlace' )
409
410
411     elif self.longitudinale:
412       if externe:
413         raybor = r_cintr + de/2.
414         rayint = raybor - profondeur
415         rayext = raybor + profondeur
416       else:
417         rayext = r_cintr + de/2. - epais
418         rayint = raybor + profondeur
419         rayext = raybor - profondeur
420       lgfond = longueur -2*profondeur
421       angle = lgfond/(2*raybor)
422       pb = geompy.MakeVertex(-raybor, 0, 0)
423       pi = geompy.MakeVertex(-rayint, 0, 0)
424       pe = geompy.MakeVertex(-rayext, 0, 0)
425       pl = geompy.MakeVertex(-raybor, 0, -profondeur)
426       pr = geompy.MakeVertex(-raybor, 0, profondeur)
427       pil = geompy.MakeRotation(pi, OY, -angle)
428       pll = geompy.MakeRotation(pl, OY, -angle)
429       pel = geompy.MakeRotation(pe, OY, -angle)
430       pir = geompy.MakeRotation(pi, OY, angle)
431       prr = geompy.MakeRotation(pr, OY, angle)
432       per = geompy.MakeRotation(pe, OY, angle)
433       arcl = geompy.MakeArc(pil, pll, pel)
434       arcr = geompy.MakeArc(pir, prr, per)
435       arci = geompy.MakeArc(pil, pi, pir)
436       arce = geompy.MakeArc(pel, pe, per)
437       geompy.addToStudy( arcl, 'arcl' )
438       geompy.addToStudy( arcr, 'arcr' )
439       geompy.addToStudy( arci, 'arci' )
440       geompy.addToStudy( arce, 'arce' )
441       wire0 = geompy.MakeWire([arcr, arci, arcl])
442       cercle0 = geompy.MakeCircle(O, OZ, profondeur/4.0)
443       #cercle0 = geompy.MakeRotation(cercle0, OZ, math.pi/2.0)
444       cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
445       geompy.addToStudy( cercle0, 'cercle0' )
446       facetube0 = geompy.MakeFaceWires([cercle0], 1)
447       facetubel = geompy.MakeRotation(facetube0, OY, -angle)
448       facetuber = geompy.MakeRotation(facetube0, OY, angle)
449       geompy.addToStudy(facetubel , 'facetubel' )
450       geompy.addToStudy( facetuber, 'facetuber' )
451       face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
452       plan0 = geompy.MakePlane(O, OY, 10000)
453       geompy.addToStudy( face0, 'facefissOrig' )
454       facefiss = geompy.MakeRotation(face0, OY, alpha*math.pi/180.)
455       geompy.addToStudy( facefiss, 'facefissPlace' )
456       centre = geompy.MakeRotation(pb, OY, alpha*math.pi/180.)
457       geompy.addToStudy( centre, 'centrefissPlace' )
458       arcr = geompy.MakeRotation(arcr, OY, alpha*math.pi/180.)
459       arci = geompy.MakeRotation(arci, OY, alpha*math.pi/180.)
460       arcl = geompy.MakeRotation(arcl, OY, alpha*math.pi/180.)
461       wiretube = geompy.MakeRotation(wire0, OY, alpha*math.pi/180.)
462       geompy.addToStudy(wiretube, 'wiretubePlace' )
463       facetubel = geompy.MakeRotation(facetubel, OY, alpha*math.pi/180.)
464       geompy.addToStudy(facetubel, 'facetubeGauche' )
465       facetuber = geompy.MakeRotation(facetuber, OY, alpha*math.pi/180.)
466       geompy.addToStudy(facetubel, 'facetubeDroit' )
467       planfiss = geompy.MakeRotation(plan0, OY, alpha*math.pi/180.)
468       geompy.addToStudy(planfiss, 'planfissPlace' )
469       pipefissl = geompy.MakePipe(facetubel, arcl)
470       pipefissi = geompy.MakePipe(facetubel, arci)
471       pipefissr = geompy.MakePipe(facetuber, arcr)
472       pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
473       geompy.addToStudy(pipefiss, 'pipefissPlace' )
474     else:
475       pass
476
477     mailleur = self.mailleur2d3d()
478     coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10, mailleur)
479
480     return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, facetubel, facetuber, planfiss, pipefiss]
481
482   # ---------------------------------------------------------------------------
483   def setParamMaillageFissure(self):
484     self.maillageFissureParams = dict(nomRep        = os.curdir,
485                                       nomFicSain    = self.nomCas,
486                                       nomFicFissure = self.nomCas + "_fissure",
487                                       nbsegExt      = 5,
488                                       nbsegGen      = 25,
489                                       nbsegRad      = 5,
490                                       scaleRad      = 4,
491                                       nbsegCercle   = 6,
492                                       nbsegFis      = 20,
493                                       lensegEllipso = 1.0)
494
495   # ---------------------------------------------------------------------------
496   def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
497     elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
498     return elementsDefaut
499
500   # ---------------------------------------------------------------------------
501   def genereMaillageFissure(self, geometriesSaines, maillagesSains,
502                             shapesFissure, shapeFissureParams,
503                             maillageFissureParams, elementsDefaut, step, \
504                                   mailleur="MeshGems"):
505
506     mailleur = self.mailleur2d3d()
507     maillageFissure = insereFissureLongue(geometriesSaines, maillagesSains,
508                                           shapesFissure, shapeFissureParams,
509                                           maillageFissureParams, elementsDefaut, step, \
510                                                mailleur)
511     return maillageFissure
512
513   # ---------------------------------------------------------------------------
514   def setReferencesMaillageFissure(self):
515     self.referencesMaillageFissure = dict( \
516                                           Entity_Quad_Quadrangle = 6710, \
517                                           Entity_Quad_Hexa = 8656, \
518                                           Entity_Node = 76807, \
519                                           Entity_Quad_Edge = 1006, \
520                                           Entity_Quad_Triangle = 2342, \
521                                           Entity_Quad_Tetra = 20392, \
522                                           Entity_Quad_Pyramid = 1232, \
523                                           Entity_Quad_Penta = 1176 \
524                                          )
525