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 """Identification edges fond de fissure, edges pipe sur la face de fissure,
22 edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
29 from .geomsmesh import geompy
30 from .geomsmesh import geomPublishInFather
32 from .extractionOrientee import extractionOrientee
33 from .extractionOrienteeMulti import extractionOrienteeMulti
35 def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
36 edgesPipeFiss, edgesFondFiss, aretesVivesC,
37 fillingFaceExterne, centreFondFiss):
39 # -----------------------------------------------------------------------
40 # --- identification edges fond de fissure, edges pipe sur la face de fissure,
42 # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
47 edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
48 geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
49 edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
50 geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "edgesFondFiss")
52 if aretesVivesC is None:
53 [edgesInside, _, _] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
54 [facesInside, _, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
56 [edgesInside, _, _] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
57 [facesInside, _, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
59 edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
60 verticesPipePeau = list()
62 for i_aux, edge in enumerate(edgesPipeIn):
64 vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
65 verticesPipePeau.append(vertices[0])
66 name = "edgePipeIn{}".format(i_aux)
67 geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
68 name = "verticePipePeau{}".format(i_aux)
69 geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name)
70 logging.debug("edgePipeIn%s coupe les faces OnSide", i_aux)
72 logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i_aux)
75 if verticesPipePeau: # au moins une extrémité du pipe sur cette face de peau
76 tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
77 edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
79 return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)