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 """Trouver les vertices d'un wire"""
26 from .geomsmesh import geompy
27 from .geomsmesh import geomPublishInFather
29 def findWireVertices(aWire, edges, getNormals=False):
30 """Trouver les vertices d'un wire
32 Calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
42 vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
45 vertex_0 = geompy.MakeVertexOnCurve(edge, 0.0)
46 tangente_0 = geompy.MakeTangentOnCurve(edge, 0.0)
47 tangente_1 = geompy.MakeTangentOnCurve(edge, 1.0)
48 dist = geompy.MinDistance(vertex_0, vert[0])
49 logging.debug("distance %s", dist)
51 normals += [tangente_0, tangente_1]
53 normals += [tangente_1, tangente_0]
55 for nro, sub in enumerate(vertices):
56 subid = geompy.GetSubShapeID(aWire, sub)
57 if subid in list(idsubs.keys()):
58 idsubs[subid].append(sub)
61 name='vertex{}'.format(nro)
62 geomPublishInFather(initLog.debug, aWire, sub, name)
64 idnorm[subid] = normals[nro]
65 name='norm{}'.format(nro)
66 geomPublishInFather(initLog.debug, aWire, normals[nro], name)
67 logging.debug("idsubs: %s", idsubs)