Salome HOME
Mise à niveau python
[modules/smesh.git] / src / Tools / blocFissure / gmu / identifieEdgesPeau_c.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021  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 """edges de la face de peau partagées avec la face de fissure"""
21
22 import logging
23
24 from . import initLog
25
26 from .geomsmesh import geompy
27 from .geomsmesh import geomPublishInFather
28
29 from .substractSubShapes import substractSubShapes
30
31 def identifieEdgesPeau_c(verticesPipePeau, facePeau, edgesListees, verticesCircPeau):
32   """edges de la face de peau partagées avec la face de fissure"""
33   logging.info('start')
34
35   edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
36   edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
37   edgesFissurePeau = list()
38
39   if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
40     edgesFissurePeau = [None for _ in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier
41     for edge in edges:
42       for i_aux, grpVert in enumerate(verticesCircPeau):
43         if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
44           edgesFissurePeau[i_aux] = edge
45           name = "edgeFissurePeau{}".format(i_aux)
46           geomPublishInFather(initLog.debug, facePeau,  edge, name)
47     for edge in edges: # on ajoute après les edges manquantes
48       if edge not in edgesFissurePeau:
49         edgesFissurePeau.append(edge)
50
51   else:
52     for i_aux, edge in enumerate(edges):
53       edgesFissurePeau.append(edge)
54       name = "edgeFissurePeau{}".format(i_aux)
55       geomPublishInFather(initLog.debug, facePeau,  edge, name)
56
57   return edgesFissurePeau