Measure mininum distance for two SEW bodyies

I'm studying the measure method for two SEW bodies. but there is error.
Who can please help me?
The goal is to measure the minimum distance between two SEW bodies.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF

Module Module12222

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim obj1 As TaggedObject
Dim obj2 As TaggedObject

Dim guess1(2) As Double
Dim guess2(2) As Double
Dim pt1(2) As Double
Dim pt2(2) As Double
Dim minDist As Double

Dim body1 As Features.Feature = CType(workPart.Features.FindObject("SEW(274)"), Features.Feature)
obj1 = body1

Dim body2 As Features.Feature = CType(workPart.Features.FindObject("SEW(275)"), Features.Feature)
obj2 = body2
theUfSession.Modl.AskMinimumDist(obj1.Tag, obj2.Tag, 0, guess1, 0, guess2, minDist, pt1, pt2)
lw.Open()
lw.WriteLine("minimum distance: " & minDist.ToString)

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Thanks.

The minimum distance command works on geometric objects (point, body, curve, etc), not on feature objects. The code that you currently have attempts to find the distance between 2 features, which the minimum distance function won't do. If you have a reference to a sew feature, you can use the object's .GetBodies method to get the sheet or solid bodies created by the feature. You can then use these bodies as input the the minimum distance function.

Though not dealing specifically with sew features, there is code in the link below that shows how to get the bodies created by a feature.
http://nxjournaling.com/comment/4657#comment-4657