1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2024 CEA, EDF
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 """Position des points extremite du pipe sur l'edge debouchante"""
28 from .geomsmesh import geompy
29 from .geomsmesh import geomPublishInFather
31 from .fissError import fissError
33 def identifieElementsDebouchants_c(iedf,\
34 partitionPeauFissFond, wireFondFiss, \
35 centre, localEdgeInFondFiss, cercle, loc_pt0, lgp, pipexts):
36 """Position des points extremite du pipe sur l'edge debouchante"""
41 # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
42 locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
43 edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
44 edgesLocSorted =[(geompy.MinDistance(edge, loc_pt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
47 ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre loc_pt0
49 texte = "Identification des éléments au débouché du pipe sur la face externe impossible. "
50 texte += "Cause possible : la ligne de fond de fissure comprend un point géométrique coincidant avec la face externe. "
51 texte += "La ligne de fond de fissure doit déboucher franchement de la face externe, et ne doit pas être coupée au niveau de la face."
52 raise fissError(traceback.extract_stack(),texte)
53 logging.debug("distance curviligne centre extremite0: %s", ofp)
54 point_1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, loc_pt0)
55 point_2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, loc_pt0)
56 geomPublishInFather(initLog.debug, wireFondFiss, point_1, "point_1_{}".format(iedf))
57 geomPublishInFather(initLog.debug, wireFondFiss, point_2, "point_2_{}".format(iedf))
59 edgePart = geompy.MakePartition([localEdgeInFondFiss], [point_1,point_2], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
60 edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
62 if geompy.MinDistance(centre, edp) < 1.e-3:
63 pipext = geompy.MakePipe(cercle, edp)
64 name = "pipeExt{}".format(iedf)
65 geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name)
66 pipexts.append(pipext)