
'----------------------------------------------------------------------
'
'WeldMesh v1.1 / André Adam
'
'Welds all points that share the same position on a polymesh object.
'
'----------------------------------------------------------------------
Set oSelection = Selection
If oSelection.Count = 1 Then
If oSelection(0).Type = "polymsh" Then
Do
Found = False
oVertices = oSelection(0).ActivePrimitive.Geometry.Points.PositionArray
i = 0
While (i < UBound(oVertices, 2)) And Not Found
Vertice1X = Round(oVertices(0, i), 3)
Vertice1Y = Round(oVertices(1, i), 3)
Vertice1Z = Round(oVertices(2, i), 3) j = i + 1 While (j < UBound(oVertices, 2)) And Not Found Vertice2X = Round(oVertices(0, j), 3)
Vertice2Y = Round(oVertices(1, j), 3)
Vertice2Z = Round(oVertices(2, j), 3)
If Vertice1X = Vertice2X And Vertice1Y = Vertice2Y And Vertice1Z 
Vertice2Z Then
ApplyTopoOp "WeldPoints", oSelection(0) & ".pnt[" & i & ", " & j &
"]"
Found = True
End If
j = j + 1
Wend
i = i + 1
Wend
Loop While Found
Else
LogMessage "Wrong Selection", siError
End If
Else
LogMessage "Wrong Selection", siError
End If


