×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NXOpen Custom Dialog Box for Selecting Drafting Notes.

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.

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.

A "note" object has a type of: UF_drafting_entity_type (25) and a subtype of: UF_draft_note_subtype (1).

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 Module 

www.nxjournaling.com

RE: NXOpen Custom Dialog Box for Selecting Drafting Notes.

(OP)
Thank you very much Cowski. Just what I was looking for. Most of the time, just need a hint of where to look for information and you hit the nail on the head. That was a perfect lead to look at the uf_object_types.h.

Awesome. thank you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources