X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FfacesFissure.py;h=159641c9d24dfcf63baff163f1fe9411de73a3ab;hb=6e356afaff4f01d88f76e5cde2cbfcadebe47c50;hp=3e51289c140c99a9598dee2600524f63a3207920;hpb=0003e6b4fcc95a0aec695ceef8371dee28baf417;p=modules%2Fsmesh.git diff --git a/src/Tools/blocFissure/gmu/facesFissure.py b/src/Tools/blocFissure/gmu/facesFissure.py index 3e51289c1..159641c9d 100644 --- a/src/Tools/blocFissure/gmu/facesFissure.py +++ b/src/Tools/blocFissure/gmu/facesFissure.py @@ -1,31 +1,50 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2021 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 +# +"""Faces fissure dans et hors tore, et edges face hors tore""" import logging -from .geomsmesh import geompy -from .geomsmesh import geomPublish -from .geomsmesh import geomPublishInFather + +import GEOM + from . import initLog -# ----------------------------------------------------------------------------- -# --- faces fissure dans et hors tore, et edges face hors tore +from .geomsmesh import geompy +from .geomsmesh import geomPublishInFather def facesFissure(blocp, faceFissure, extrusionDefaut, genint): - """ - extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi + """Extraction des faces de fissure dans et hors tore, des edges le long du tore et en paroi + @param faceFissure : la face de fissure avec la partie dans le tore elliptique et la partie externe @return (facefissintore, facefissoutore, edgeint, edgeext) """ logging.info('start') - [f0,f1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True) - ed0 = geompy.ExtractShapes(f0, geompy.ShapeType["EDGE"], True) - ed1 = geompy.ExtractShapes(f1, geompy.ShapeType["EDGE"], True) + [face_0,face_1] = geompy.ExtractShapes(faceFissure, geompy.ShapeType["FACE"], True) + ed0 = geompy.ExtractShapes(face_0, geompy.ShapeType["EDGE"], True) + ed1 = geompy.ExtractShapes(face_1, geompy.ShapeType["EDGE"], True) if len(ed0) > len(ed1): - facefissintore = f0 - facefissoutore = f1 + facefissintore = face_0 + facefissoutore = face_1 else: - facefissintore = f1 - facefissoutore = f0 + facefissintore = face_1 + facefissoutore = face_0 geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore') geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore') @@ -33,18 +52,18 @@ def facesFissure(blocp, faceFissure, extrusionDefaut, genint): edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN) edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON) - for i in range(len(edgeint)): - name = "edgeint_%d"%i - geomPublishInFather(initLog.debug, facefissoutore, edgeint[i],name) - for i in range(len(edgeext)): - name = "edgeext_%d"%i - geomPublishInFather(initLog.debug, facefissoutore, edgeext[i],name) + for i_aux, edge in enumerate(edgeint): + name = "edgeint_{}".format(i_aux) + geomPublishInFather(initLog.debug, facefissoutore, edge,name) + for i_aux, edge in enumerate(edgeext): + name = "edgeext_{}".format(i_aux) + geomPublishInFather(initLog.debug, facefissoutore, edge,name) - reverext = [] + reverext = list() if len(edgeext) > 1: vertices = geompy.ExtractShapes(genint, geompy.ShapeType["VERTEX"], False) - for i in range(len(edgeext)): - vertedge = geompy.ExtractShapes(edgeext[i], geompy.ShapeType["VERTEX"], False) + for edge in edgeext: + vertedge = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) if ((geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[0])) or (geompy.GetSubShapeID(blocp, vertedge[0]) == geompy.GetSubShapeID(blocp, vertices[1]))): reverext.append(0)