Sample NX Open .NET Visual Basic routine : select a component

Sample NX Open .NET Visual Basic routine : select a component

Imports System
Imports NXOpen
Imports NXOpen.Assemblies
Imports NXOpenUI
Imports NXOpen.UF

    Function select_a_component(ByRef obj As Component) As Selection.Response

            Dim ui As UI = UI.GetUI()
            Dim mask(0) As Selection.MaskTriple
                With mask(0)
                    .Type = UFConstants.UF_component_type
                    .Subtype = 0
                    .SolidBodySubtype = 0
                End With
            Dim cursor As Point3d = Nothing
            Dim prompt As String = "Select a component"

            Dim resp As Selection.Response = _
                ui.SelectionManager.SelectObject(prompt, prompt, _
                Selection.SelectionScope.AnyInAssembly, _
                Selection.SelectionAction.ClearAndEnableSpecific, _
                False, False, mask, obj, cursor)

        If resp = Selection.Response.ObjectSelected Or _
           resp = Selection.Response.ObjectSelectedByName Then
            return Selection.Response.Ok
        Else
            return Selection.Response.Cancel
        End If
    End Function