X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FfacesCirculaires.py;h=88636eb1173595527704c6b0daa83cedcb38fc00;hp=a624947368052994e212089f76b77cf35e75b567;hb=6cdcd4fb150ef14b95d677a7a8942ae2cfd2ac86;hpb=10191484fe88a27e962b8e4b57e09d390d8705c7 diff --git a/src/Tools/blocFissure/gmu/facesCirculaires.py b/src/Tools/blocFissure/gmu/facesCirculaires.py index a62494736..88636eb11 100644 --- a/src/Tools/blocFissure/gmu/facesCirculaires.py +++ b/src/Tools/blocFissure/gmu/facesCirculaires.py @@ -1,14 +1,32 @@ # -*- 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 +# +"""Tore : faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure""" import logging -from .geomsmesh import geompy -from .geomsmesh import geomPublish -from .geomsmesh import geomPublishInFather + from . import initLog -# ----------------------------------------------------------------------------- -# --- TORE -## --- faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure +import GEOM + +from .geomsmesh import geompy +from .geomsmesh import geomPublishInFather def facesCirculaires(bloc, tore): """ @@ -23,59 +41,42 @@ def facesCirculaires(bloc, tore): faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON) - geomPublishInFather(initLog.debug, tore, faces[0], 'face0' ) - geomPublishInFather(initLog.debug, tore, faces[1], 'face1' ) - geomPublishInFather(initLog.debug, tore, faces[2], 'face2' ) - geomPublishInFather(initLog.debug, tore, faces[3], 'face3' ) - - centres = [None, None, None, None] - [v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True) - [v1,centres[1],v3] = geompy.ExtractShapes(faces[1], geompy.ShapeType["VERTEX"], True) - [v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True) - [v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True) + centres = list() + alledges = list() + for i_aux in range(4): + geomPublishInFather(initLog.debug, tore, faces[i_aux], 'face{}'.format(i_aux)) + [_,centre,_] = geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["VERTEX"], True) + centres.append(centre) + geomPublishInFather(initLog.debug, faces[i_aux], centre, 'centre{}'.format(i_aux)) + alledges.append(geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["EDGE"], True)) - geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' ) - geomPublishInFather(initLog.debug, faces[1], centres[1], 'centre1' ) - geomPublishInFather(initLog.debug, faces[2], centres[2], 'centre2' ) - geomPublishInFather(initLog.debug, faces[3], centres[3], 'centre3' ) + dicoedge = dict() + edges = list() + reverses = list() - alledges = [None, None, None, None] - alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True) - alledges[1] = geompy.ExtractShapes(faces[1], geompy.ShapeType["EDGE"], True) - alledges[2] = geompy.ExtractShapes(faces[2], geompy.ShapeType["EDGE"], True) - alledges[3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["EDGE"], True) + for i_aux, edgesface in enumerate(alledges): - dicoedge = {} - edges = [] - reverses = [] - for i in range(len(alledges)): - edgesface = alledges[i] - lenef = [] - for j in range(len(edgesface)): - props = geompy.BasicProperties(edgesface[j]) + lenef = list() + for edge in edgesface: + props = geompy.BasicProperties(edge) lenef.append(props[0]) - pass + maxlen = max(lenef) - for j in range(len(edgesface)): - if lenef[j] < maxlen: - edgid = geompy.GetSubShapeID(tore, edgesface[j]) + for j_aux, edge in enumerate(edgesface): + if lenef[j_aux] < maxlen: + edgid = geompy.GetSubShapeID(tore, edge) if not (edgid in dicoedge): - dicoedge[edgid] = edgesface[j] - edges.append(edgesface[j]) - named = 'edge_' + str(i) + '_' +str(j) - geomPublishInFather(initLog.debug, faces[i], edgesface[j], named) - vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False) - #firstVertex = geompy.GetFirstVertex(edgesface[j]) - if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]): + dicoedge[edgid] = edge + edges.append(edge) + named = 'edge_{}_{}'.format(i_aux,j_aux) + geomPublishInFather(initLog.debug, faces[i_aux], edge, named) + vertices = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) + #firstVertex = geompy.GetFirstVertex(edge) + if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i_aux]): reverses.append(1) #print 'reversed ' + str(edgid) else: reverses.append(0) #print 'normal' + str(edgid) - pass - pass - pass - pass return faces, centres, edges, reverses -