distance between 2 points

I'm trying to find the minimum distance between 2 points but I keep getting an error.
I get and error saying I can't convert a point3d to an object

This is what I have so far:

Dim LEpoint as Point3D
Dim intpoint as Point3D

Dim chord As MeasureDistance = workPart.MeasureManager.NewDistance(workPart.UnitCollection.FindObject("Milimiters"), MeasureManager.MeasureType.Minimum, LEpoint, intpoint)

lw.writeline ("distance is " & chord.value)

The MeasureManager.NewDistance method requires two objects of type "DisplayableObject" to be passed to the method. You could create a point object using the Point3D coordinates, then delete it after you get the distance value.

Alternatively, you could use the AskMinimumDist function to find the distance. It allows the input of point coordinates in the form of arrays of double values. In this case, you could convert the Point3D coordinates to arrays and pass them to the function.

Nice that would be faster then creating a point and thane deleting it.

Can you show me an example, I can’t find the apis for it and keeps telling me I’m missing something for it to work.

Thanks

The code below calculates the distance between the point locations represented by the arrays pt1 and pt2.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ")

lw.Open()

Dim pt1() As Double = {0, 0, 0}
Dim pt2() As Double = {3.14, 2.71, 1.41}

Dim temp1(2) As Double
Dim temp2(2) As Double
Dim minDist As Double
theUfSession.Modl.AskMinimumDist(Nothing, Nothing, 1, pt1, 1, pt2, minDist, temp1, temp2)

lw.WriteLine("minimum distance: " & minDist.ToString)

lw.Close()

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