Salome HOME
Copyright update 2022
[modules/smesh.git] / src / Tools / blocFissure / gmu / identifieElementsDebouchants_b.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2022  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 """Estimation de la longueur du pipe necessaire de part et d'autre du point de sortie"""
21
22 import logging
23 import math
24
25 from .geomsmesh import geompy
26
27 from .whichSide import whichSide
28
29 def identifieElementsDebouchants_b(ifil, \
30                                   facesDefaut,aretesVivesC, fillingFaceExterne, rayonPipe, \
31                                   ptPeau, centre, norm, localEdgeInFondFiss):
32   """Estimation de la longueur du pipe necessaire de part et d'autre du point de sortie"""
33
34   logging.info('start')
35
36   # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
37   if aretesVivesC is None:
38     face_test_peau = fillingFaceExterne
39   else:
40     face_test_peau = facesDefaut[ifil]
41   side_centre = whichSide(face_test_peau, centre)
42   loc_pt0 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 0.0)
43   loc_pt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
44   side_point_0 = whichSide(face_test_peau, loc_pt0)
45   side_point_1 = whichSide(face_test_peau, loc_pt1)
46   logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", side_centre, side_point_0, side_point_1)
47   norm_face = geompy.GetNormal(face_test_peau, ptPeau)
48   incl_pipe = abs(geompy.GetAngleRadians(norm, norm_face))
49   lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(incl_pipe)))
50   logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", incl_pipe*180/math.pi, lgp)
51
52   return loc_pt0, lgp