1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021 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"""
24 from .geomsmesh import geompy
25 from .geomsmesh import geomPublishInFather
29 def calculePointsAxiauxPipe_b(meshFondFiss, \
30 edgesFondFiss, edgesIdByOrientation, \
31 wireFondFiss, wirePipeFiss, \
33 """Préparation maillage du pipe :
35 - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
36 - points sur les edges de fond de fissure et edges pipe/face fissure,
37 - vecteurs tangents au fond de fissure (normal au disque maillé)
42 ptGSdic = dict() # dictionnaire [paramètre sur la courbe] --> point géométrique
43 allNodeIds = meshFondFiss.GetNodesId()
44 for nodeId in allNodeIds:
45 xyz = meshFondFiss.GetNodeXYZ(nodeId)
46 #logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
47 point = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
48 parametre, _, EdgeInWireIndex = geompy.MakeProjectionOnWire(point, wireFondFiss) # parametre compris entre 0 et 1
49 edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
50 ptGSdic[(edgeOrder, EdgeInWireIndex, parametre)] = point
51 #logging.debug("nodeId %s, parametre %s", nodeId, str(parametre))
52 usort = sorted(ptGSdic)
53 logging.debug("nombre de points obtenus par deflexion : %s",len(usort))
58 for i_aux, edu in enumerate(usort):
60 geomPublishInFather(initLog.debug, wireFondFiss, vertcx, "vertcx_{}".format(i_aux))
61 norm = geompy.MakeTangentOnCurve(edgesFondFiss[edu[1]], edu[2])
62 plan = geompy.MakePlane(vertcx, norm, 3.*rayonPipe)
63 part = geompy.MakePartition([plan], [wirePipeFiss], list(), list(), geompy.ShapeType["VERTEX"], 0, list(), 0)
64 liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
65 if ( len(liste) == 5 ): # 4 coins du plan plus intersection recherchée
67 if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin
69 geomPublishInFather(initLog.debug, wireFondFiss, vertpx, "vertpx_{}".format(i_aux))
71 centres.append(vertcx)
72 origins.append(vertpx)
75 return centres, origins, normals