# Macro JointWire

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎svenska • ‎čeština
!!! This macro needs to be corrected. !!!
Description
!!! This macro needs to be corrected. !!!
This macro allow to find and joint all non connected edge to the closest non connected one using a line. It take a shape matrix in entry ([shape1, shape2, ...])

Macro version: 1.0
Author
Tremblou
ToolBar Icon
Macro Version
1.0
2011-08-24
All
Default shortcut
None
None

## Description

This macro allow to find and joint all non connected edge to the closest non connected one using a line. It take a shape matrix in entry ( [shape1,shape2,...])

## Script

Macro_JointWire.FCMacro

```def findWires(edges):
def verts(shape):
return [shape.Vertexes.Point,shape.Vertexes[-1].Point]
def group(shapes):
shapesIn = shapes[:]
pointTst = []
pointOut =[]
for s in shapesIn :
pointTst=pointTst+[s.Vertexes.Point]
pointTst=pointTst+[s.Vertexes[-1].Point]
print pointTst
changed = False
for s in shapesIn:
if len(s.Vertexes) < 2:
print "one vertex, its a circle, just add"
else:
for v in verts(s):
twoDot=0
for vv in pointTst:
if v == vv:
twoDot=twoDot+1
if v==vv and twoDot==2 :
changed = True
print "found matching vert"
break
if twoDot<2:
print "didn't find any matching vert..."
pointOut.append(v)
print "Dots non connected", pointOut
return(changed,pointOut)
def joint(point):
for p in range(len(point)/2) :
print point
deltI=Part.Vertex(100,100,100).Point
pos=1
for pp in range(len(point)-1) :
print "position:",pp+1
if len(point)-1>1:
deltN=(point-point[pp+1])
if deltN.Length<deltI.Length:
deltI=deltN
pos=pp+1
print "changement",pos
else:
pos=1
print "points a joindre",point,point[pos]
if point!=point[pos]:
Part.show(Part.makePolygon([point,point[pos]]))
else:
print "WARNING les points ont la meme valeurs "
point.pop(0)
point.pop(pos-1)
point=0 #to have a return normally void
return(point)
working = True
edgeSet = edges
result = group(edgeSet)
working = result
edgeSet = result
joint(result)
return result```