1 # -*- coding: utf-8 -*-
4 from .geomsmesh import geompy
5 from .geomsmesh import geomPublish
6 from .geomsmesh import geomPublishInFather
9 # -----------------------------------------------------------------------------
10 # --- trouver les vertices intermediaires d'un wire
12 def findWireIntermediateVertices(aWire, getNormals=False):
14 trouver les vertices d'un wire qui ne sont pas aux extremités
15 calcul optionnel des tangentes. Attention à la tolérance qui peut être élevée (> 0.001)
18 edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], False)
27 vert = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
30 v0 = geompy.MakeVertexOnCurve(edge, 0.0)
31 n0 = geompy.MakeTangentOnCurve(edge, 0.0)
32 v1 = geompy.MakeVertexOnCurve(edge, 1.0)
33 n1 = geompy.MakeTangentOnCurve(edge, 1.0)
34 dist = geompy.MinDistance(v0, vert[0])
35 logging.debug("distance %s", dist)
40 for i, sub in enumerate(vertices):
41 subid = geompy.GetSubShapeID(aWire, sub)
42 if subid in list(idsubs.keys()):
43 idsubs[subid].append(sub)
47 geomPublishInFather(initLog.debug, aWire, sub, name)
49 idnorm[subid] = normals[i]
51 geomPublishInFather(initLog.debug, aWire, normals[i], name)
52 for k, v in idsubs.items():
54 shortList.append(v[0])
56 shortNorm.append(idnorm[k])
58 return shortList, shortNorm