1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2023 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 """Tore : faces 1/2 circulaires et leur centre, edges de ces faces dans le plan de fissure"""
28 from .geomsmesh import geompy
29 from .geomsmesh import geomPublishInFather
31 def facesCirculaires(bloc, tore):
33 Extraction des faces demi circulaires à l'intersection du tore partitionné et de la paroi,
34 de leur centre, les edges de ces faces situees dans le plan de fissure et un booleen par edge,
35 indiquant son sens (normal / reversed).
36 @param bloc : bloc defaut
37 @param tore : le tore partitionné et coupé
38 @return (faces, centres, edges, reverses)
42 faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
46 for i_aux in range(4):
47 geomPublishInFather(initLog.debug, tore, faces[i_aux], 'face{}'.format(i_aux))
48 [_,centre,_] = geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["VERTEX"], True)
49 centres.append(centre)
50 geomPublishInFather(initLog.debug, faces[i_aux], centre, 'centre{}'.format(i_aux))
51 alledges.append(geompy.ExtractShapes(faces[i_aux], geompy.ShapeType["EDGE"], True))
57 for i_aux, edgesface in enumerate(alledges):
60 for edge in edgesface:
61 props = geompy.BasicProperties(edge)
62 lenef.append(props[0])
65 for j_aux, edge in enumerate(edgesface):
66 if lenef[j_aux] < maxlen:
67 edgid = geompy.GetSubShapeID(tore, edge)
68 if not (edgid in dicoedge):
69 dicoedge[edgid] = edge
71 named = 'edge_{}_{}'.format(i_aux,j_aux)
72 geomPublishInFather(initLog.debug, faces[i_aux], edge, named)
73 vertices = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
74 #firstVertex = geompy.GetFirstVertex(edge)
75 if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i_aux]):
77 #print 'reversed ' + str(edgid)
80 #print 'normal' + str(edgid)
82 return faces, centres, edges, reverses