X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FconstruitEdgesRadialesDebouchantes.py;h=647fc79b997c7430a4e0e296cbd68a40b146a298;hp=d77ccafd65d77cfbe49f1fedee9dec725e340a90;hb=6d32f944a0a115b6419184c50b57bf7c4eef5786;hpb=a8380feec5b500ecfb5d0254e9126103539f4a78 diff --git a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py index d77ccafd6..647fc79b9 100644 --- a/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py +++ b/src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py @@ -1,23 +1,41 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2019 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM -from sortEdges import sortEdges +from .sortEdges import sortEdges def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, facesPipePeau, edgeRadFacePipePeau, nbsegCercle): """ - construction des listes d'edges radiales sur chaque extrémité débouchante + construction des listes d'edges radiales sur chaque extrémité débouchante """ logging.info('start') - + # --- listes de nappes radiales en filling à chaque extrémité débouchante - + facesDebouchantes = [False, False] idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau) listNappes =[] @@ -47,7 +65,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, geomPublish(initLog.debug, nappe, name) facesDebouchantes[i] = True listNappes.append(nappes) - + # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau) for i, nappes in enumerate(listNappes): if facesDebouchantes[i]: @@ -82,27 +100,48 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks, else: maxl = geompy.BasicProperties(edge)[0] if maxl < 0.01: # problème MakeSection - logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl) + logging.info("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl) partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0) edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False) ednouv = [] for ii, ed in enumerate(edps): + dmax=100. vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False) distx = [geompy.MinDistance(vx, face) for vx in vxs] distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs] dmax = max(distx) - logging.debug(" dmax %s",dmax) - if dmax < 0.01: + lgedge = geompy.BasicProperties(ed)[0] + logging.debug(" dmax %s, longueur edge %s",dmax, lgedge) + if dmax < 0.01 and lgedge > 0.01: ednouv.append(ed) - logging.debug(" edges issues de la partition: %s", ednouv) - for ii, ed in enumerate(ednouv): - geomPublish(initLog.debug, ed, "ednouv%d"%ii) - [edsorted, minl,maxl] = sortEdges(ednouv) - logging.debug(" longueur edge trouvée: %s", maxl) - edge = edsorted[-1] + if (len(ednouv) > 0): + logging.debug(" edges issues de la partition: %s", ednouv) + for ii, ed in enumerate(ednouv): + geomPublish(initLog.debug, ed, "ednouv%d"%ii) + [edsorted, minl,maxl] = sortEdges(ednouv) + logging.debug(" longueur edge trouvée: %s", maxl) + edge = edsorted[-1] + else: + logging.info("problème partition recherche edge radiale %s", k) + vxs = geompy.ExtractShapes(partNappeFace, geompy.ShapeType["VERTEX"], False) + vxnouv=[] + for ii,vx in enumerate(vxs): + distx = geompy.MinDistance(vx, face) + distx += geompy.MinDistance(vx, nappes[k]) + logging.debug("vertex distance: %s", distx) + if distx < 0.005: + vxnouv.append(vx) + logging.debug("nombre vertex candidats %s", len(vxnouv)) + if len(vxnouv) >= 2: + eds = [geompy.MakeEdge(vxnouv[j],vxnouv[(j+1)%len(vxnouv)]) for j in range(len(vxnouv))] + [edsorted2, minl,maxl] = sortEdges(eds) + edge = edsorted2[-1] + logging.debug("lg edge: %s", maxl) + else: + logging.debug("problème recherche edge radiale %s non résolu", k) edges.append(edge) name = 'edgeEndPipe%d'%k geomPublish(initLog.debug, edge, name) listEdges.append(edges) - + return (listEdges, idFacesDebouchantes) \ No newline at end of file