1 # -*- coding: utf-8 -*-
4 from .geomsmesh import geompy
5 from .geomsmesh import geomPublish
6 from .geomsmesh import geomPublishInFather
8 from .orderEdgesFromWire import orderEdgesFromWire
10 # -----------------------------------------------------------------------------
11 # --- prolongation d'un wire par deux segments tangents
13 def prolongeWire(aWire, extrem, norms, long):
17 if geompy.NumberOfEdges(aWire) > 1:
18 edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
24 for i, v1 in enumerate(extrem):
25 exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-int, int)]
26 dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
29 edge = geompy.MakeEdge(v1, v2)
31 edgesBout.append(edge)
33 geomPublish(initLog.debug, edge, name)
35 wireProlonge = geompy.MakeWire(edges)
36 geomPublish(initLog.debug, wireProlonge, "wireProlonge")
38 logging.warning("probleme MakeWire, approche pas a pas")
43 edgelist, accessList = orderEdgesFromWire(aWire)
44 edge1 = edgelist[accessList[0]]
45 if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
51 wireProlonge = edgesBout[i0]
52 for i in range(len(edgelist)):
53 wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
54 geomPublish(initLog.debug, wireProlonge, "wireProlonge_%d"%i)
55 wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
56 geomPublish(initLog.debug, wireProlonge, "wireProlonge")
57 logging.warning("prolongation wire pas a pas OK")