1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2023 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 """Préparation maillage du pipe"""
25 from .geomsmesh import geompy
27 def calculePointsAxiauxPipe_c(centres, origins, normals, \
28 rayonPipe, nbsegCercle, nbsegRad):
29 """Préparation maillage du pipe :
31 - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
32 - points sur les edges de fond de fissure et edges pipe/face fissure,
33 - vecteurs tangents au fond de fissure (normal au disque maillé)
37 logging.debug("nbsegCercle = %d, nbsegRad = %d", nbsegCercle, nbsegRad)
39 # -----------------------------------------------------------------------
40 # --- points géométriques
42 gptsdisks = list() # vertices géométrie de tous les disques
43 raydisks = [list() for _ in range(nbsegCercle)]
45 # boucle sur les disques
46 for indice, centres_i in enumerate(centres):
47 gptdsk = list() # vertices géométrie d'un disque
49 vertpx = origins[indice]
50 normal = normals[indice]
51 vec1 = geompy.MakeVector(vertcx, vertpx)
53 points = [vertcx] # les points du rayon de référence
54 dist_0 = rayonPipe/float(nbsegRad)
55 for j_aux in range(nbsegRad):
56 point = geompy.MakeTranslationVectorDistance(vertcx, vec1, float(j_aux+1)*dist_0)
59 point = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
60 rayon = geompy.MakeLineTwoPnt(vertcx, point)
61 raydisks[0].append(rayon)
63 angle_0 = 2.*math.pi/float(nbsegCercle)
64 for k_aux in range(nbsegCercle-1):
65 angle = float(k_aux+1)*angle_0
66 pts = [vertcx] # les points d'un rayon obtenu par rotation
67 for j_aux in range(nbsegRad):
68 point = geompy.MakeRotation(points[j_aux+1], normal, angle)
71 ray = geompy.MakeRotation(rayon, normal, angle)
72 raydisks[k_aux+1].append(ray)
74 gptsdisks.append(gptdsk)
76 return gptsdisks, raydisks