Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Measure mininum distance for two SEW bodyies

$
0
0

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.


Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>