Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim theFace As Face
If SelectFace("Select a face", theFace) = Selection.Response.Cancel Then
Exit Sub
End If
'MsgBox(theFace.Tag.ToString)
Dim numRadii As Integer
Dim radii(1) As Double
Dim positions(5) As Double
Dim params(3) As Double
theUfSession.Modl.AskFaceMinRadii(theFace.Tag, numRadii, radii, positions, params)
lw.WriteLine("number of radii: " & numRadii.ToString)
lw.WriteLine("radius 1: " & radii(0).ToString)
lw.WriteLine("radius 2: " & radii(1).ToString)
lw.Close()
End Sub
Function SelectFace(ByVal prompt As String, ByRef tempFace As Face) As Selection.Response
Dim selObj As TaggedObject
Dim theUI As UI = UI.GetUI
Dim title As String = "Select a face"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ANY_FACE
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selobj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
tempFace = selObj
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module