Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a tabular note in all sheets

Status
Not open for further replies.

MANox

Mechanical
Apr 2, 2007
130
Hello,

some times ago I found in Iternet function for select table note:
Code:
    Function select_a_tabular_note(ByRef tabular_note As NXOpen.Tag) As Selection.Response

        Dim message As String
        Dim title As String = "Select a tabular note"
        Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
        Dim response As Integer
        Dim obj As NXOpen.Tag
        Dim view As NXOpen.Tag
        Dim cursor(2) As Double
        Dim ip As UFUi.SelInitFnT = AddressOf init_proc
        nxopenSession.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)

        Try
            nxopenSession.Ui.SelectWithSingleDialog(message, title, scope, ip, Nothing, response, tabular_note, cursor, view)
        Finally
            nxopenSession.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
        End Try

        If response <> UFConstants.UF_UI_OBJECT_SELECTED Then
            Return Selection.Response.Cancel
        Else
            Return Selection.Response.Ok
        End If

    End Function
    Function init_proc(ByVal select_ As IntPtr, ByVal userdata As IntPtr) As Integer
        ' Selection initialization

        Dim num_triples As Integer = 1
        Dim mask_triples(0) As UFUi.Mask
        mask_triples(0).object_type = UFConstants.UF_tabular_note_type
        mask_triples(0).object_subtype = UFConstants.UF_tabular_note_section_subtype
        mask_triples(0).solid_type = 0

        theUfSession.Ui.SetSelMask(select_, UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, num_triples, mask_triples)
        Return UFConstants.UF_UI_SEL_SUCCESS

    End Function

But this operation is possible only in active sheet.
Can I modyfity something for selection in all sheets in drawing file?

Best regards

MANok
NX12 & TC10
NX1992 & Native
 
Replies continue below

Recommended for you

There is a table section collection in the part's annotations that you can use to access all of the tabular notes. The code below deletes all the tabular notes in a part.

Code:
    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession()
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim workPart As Part = theSession.Parts.Work


        Dim myTables() As Annotations.TableSection
        myTables = workPart.Annotations.TableSections.ToArray

        lw.WriteLine(workPart.FullPath)
        lw.WriteLine("number of table sections: " & myTables.Length.ToString)

        Dim markId5 As Session.UndoMarkId
        markId5 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete Tables")

        Dim nErrs1 As Integer
        nErrs1 = theSession.UpdateManager.AddToDeleteList(myTables)

        Dim notifyOnDelete2 As Boolean
        notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete

        Dim nErrs2 As Integer
        nErrs2 = theSession.UpdateManager.DoUpdate(markId5)


    End Sub

www.nxjournaling.com
 
Thanks cowski,

standard, I have 5 sheets with 5 tabular notes, and I can use any of them. I use function similar to You code.
But in untypical situation I must select manualy table, to get data.
If manualy selection is imposible, I can do it in another way.
But I think, this way would be more easy.

Best regards

MANok
NX12 & TC10
NX1992 & Native
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor