Blend all edges in z-direction

Hello,

I am looking to create VB code that will select all edges in the z-direction in the attached geometry image and apply a 4mm edge blend to them (from picture 1 to picture 2).

Picture 1:
http://i.imgur.com/UA1ncA3.png

Picture 2:
http://i.imgur.com/QHhRI7j.png

Thank you for your help.

Here is code that uses Snap functions. You could do the same thing using NX/Open functions; the code would just be somewhat longer, but the ideas/principles would be the same:

Option Infer On
Imports Snap, Snap.Create

Public Class MyProgram

Public Shared Sub Main()

Dim radius = 4
Dim blendList As List(Of Snap.NX.Edge.Line)

For Each body In Snap.Globals.WorkPart.Bodies
blendList = New List(Of NX.Edge.Line)()
For Each edge In body.Edges
If edge.ObjectSubType = Snap.NX.ObjectTypes.SubType.EdgeLine
Dim line = CType(edge, Snap.NX.Edge.Line)
If IsVertical(line) Then blendList.Add(line)
End If
Next edge
EdgeBlend(radius, blendList.ToArray)
Next body

End Sub

Public Shared Function IsVertical(lineEdge As Snap.NX.Edge.Line) As Boolean
Dim vert = False
Dim epsilon = 0.01
Dim lineVector = lineEdge.EndPoint - lineEdge.StartPoint
Dim angle = Vector.Angle(lineVector, Vector.AxisZ)
If System.Math.Abs(angle) < epsilon Then vert = True
If System.Math.Abs(angle - 180) < epsilon Then vert = True
Return vert
End Function

End Class

Thank you for your response ciao!