NXOpen Custom Dialog Box for Selecting Drafting Notes.
NXOpen Custom Dialog Box for Selecting Drafting Notes.
(OP)
Dear Forum,
I trying to develop a custom dialog box for the selection of a GD&T symbol or Note within a drafting sheet.
Below is the code I am having issues with getting the selection prompt to pick up on the drafting note.
Please any suggestions on what I am doing wrong. Thanks.
I trying to develop a custom dialog box for the selection of a GD&T symbol or Note within a drafting sheet.
Below is the code I am having issues with getting the selection prompt to pick up on the drafting note.
Please any suggestions on what I am doing wrong. Thanks.
CODE --> vb.net
Dim SelectColumnAnnotation As Selection.Response
Dim ColumnAnnotation As NXObject = Nothing
Try
SelectColumnAnnotation = SelectAnnotation("Select Column Annotation", ColumnAnnotation)
Catch ex As Exception
Throw New Exception("Failed Selecting Upstream Arc")
End Try
Function SelectAnnotation(ByVal prompt As String, ByRef selObj As NXObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Select an Arc"
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_annotation_type
.Subtype = 0
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
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function 




RE: NXOpen Custom Dialog Box for Selecting Drafting Notes.
There is some journal code posted at GTAC that will report the type and subtype of preselected objects. It reports the numerical value; you can then look up this value in the "uf_object_types.h" file to find the corresponding UF constant.
CODE
'Amy Webster 'Date: 03/28/2011 'Subject: Sample NX Open .NET Visual Basic program : report type and subtype of preselected objects ' 'Note: GTAC provides programming examples for illustration only, and 'assumes that you are familiar with the programming language being 'demonstrated and the tools used to create and debug procedures. GTAC 'support professionals can help explain the functionality of a particular 'procedure, but we will not modify these examples to provide added 'functionality or construct procedures to meet your specific needs. Imports System Imports NXOpen Imports NXOpen.UF Imports NXOpenUI Module journal Sub Main Dim s As Session = Session.GetSession() Dim ufs As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession() Dim selobj As NXObject Dim type As Integer Dim subtype As Integer Dim lw As ListingWindow = s.ListingWindow Dim theUI As UI = ui.GetUI Dim numsel As Integer = theUI.SelectionManager.GetNumSelectedObjects() lw.Open() lw.WriteLine("Selected Objects: " & numsel.ToString()) For inx As Integer = 0 To numsel-1 selobj = theUI.SelectionManager.GetSelectedObject(inx) ufs.Obj.AskTypeAndSubtype(selobj.Tag, type, subtype) lw.WriteLine("Object: " & selobj.ToString()) lw.WriteLine(" Tag: " & selobj.Tag.ToString()) lw.WriteLine(" Type: " & type.ToString()) lw.WriteLine(" Subtype: " & subtype.ToString()) lw.WriteLine("") Next End Sub End Modulewww.nxjournaling.com
RE: NXOpen Custom Dialog Box for Selecting Drafting Notes.
Awesome. thank you.