Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.UFModule select_an_edge_in_drawing_view
Sub Main
Dim theSession As Session = Session.GetSession()
Dim lw As ListingWindow = theSession.ListingWindow
Dim edge As Edge = nothing
lw.Open()
While select_an_edge_in_view("Select an edge", edge) = Selection.Response.Ok
lw.WriteLine("Selected edge: " & edge.ToString())
End While
End Sub
Function select_an_edge_in_view(ByVal prompt As String, ByRef obj As Edge)
Dim ui As UI = GetUI()
Dim mask(0) As Selection.MaskTriple
With mask(0)
.Type = UFConstants.UF_solid_type
.Subtype = UFConstants.UF_solid_body_subtype
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ANY_EDGE
End With
Dim cursor As Point3d = Nothing
Dim ufs As UFSession = UFSession.GetUFSession()
ufs.Ui.SetCursorView(0)
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
End Module