Salome HOME
72e766dffec6d199cfe0c2e67701314331107445
[modules/smesh.git] / src / Tools / blocFissure / gmu / prolongeWire.py
1 # -*- coding: utf-8 -*-
2
3 import logging
4 from geomsmesh import geompy
5
6 # -----------------------------------------------------------------------------
7 # --- prolongation d'un wire par deux segments tangents
8
9 def prolongeWire(aWire, extrem, norms, long):
10   """
11   """
12   logging.info("start")
13   if geompy.NumberOfEdges(aWire) > 1:
14     edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
15   else:
16     edges = [aWire]
17   for i, v1 in enumerate(extrem):
18     exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
19     dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
20     dists.sort()
21     v2 = dists[-1][-1]
22     #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
23     edge = geompy.MakeEdge(v1, v2)
24     edges.append(edge)
25     name = "extrem%d"%i
26     #geompy.addToStudy(edge,name)
27   wireProlonge = geompy.MakeWire(edges)
28   geompy.addToStudy(wireProlonge, "wireProlonge")
29   return wireProlonge