Not a tabular note......

Hey guys,

So I'm still trying to write some code to read off a table. I have tried to write something to check the first cell in each table for a name(one of the names of the table I want to extract). I manage to cycle through tables 0 and 1, but then I get an error that the object being passed for 3 isnt a tabular note. Anyone know why it would be giving me that error given the code I have? I thought I made it so it would only have tabular notes in that list.

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF

Module export_tabular_notes

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work

Sub Main()

Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Dim myTabNotes As New List(Of Tag)
FindTabularNotes(myTabNotes)

lw.WriteLine("Number of tabular notes found: " & myTabNotes.Count.ToString)
lw.WriteLine("")

lw.WriteLine("First tabular note info:")
lw.WriteLine("")

Dim numSections As Integer = 0
theUfSession.Tabnot.AskNmSections(myTabNotes.Item(0), numSections)
lw.WriteLine("Number of sections in tabular note: " & numSections.ToString)

Dim numRows As Integer = 0
theUfSession.Tabnot.AskNmRows(myTabNotes.Item(0), numRows)
lw.WriteLine("Number of rows in tabular note: " & numRows.ToString)

Dim numCols As Integer = 0
theUfSession.Tabnot.AskNmColumns(myTabNotes.Item(0), numCols)
lw.WriteLine("Number of columns in tabular note: " & numCols.ToString)
lw.WriteLine("")

Dim rowTag As Tag = Nothing
Dim colTag As Tag = Nothing
Dim cellTag As Tag = Nothing

Dim labelTables As New List(Of Tag)

For z As Integer = 0 To myTabNotes.Count - 1

lw.WriteLine(z) 'for testing purposes
theUfSession.Tabnot.AskNthRow(myTabNotes.Item(z), 0, rowTag)
theUfSession.Tabnot.AskNthColumn(myTabNotes.Item(z), 0, colTag)
theUfSession.Tabnot.AskCellAtRowCol(rowTag, colTag, cellTag)
Dim cellText As String = ""
Dim evalCellText As String = ""
theUfSession.Tabnot.AskCellText(cellTag, cellText)
theUfSession.Tabnot.AskEvaluatedCellText(cellTag, evalCellText)

if cellText = "IMPLANT COMPONENTS" Then

labelTables.Add(myTabNotes.Item(z))
End If

Next

End Sub

Sub FindTabularNotes(ByRef tagList As List(Of Tag))

Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null

Do
theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
If tmpTabNote = NXOpen.Tag.Null Then
Continue Do
End If
If tmpTabNote <> NXOpen.Tag.Null Then

tagList.Add(tmpTabNote)

End If
Loop Until tmpTabNote = NXOpen.Tag.Null

End Sub

End Module

Many of the NX objects have both a type and subtype; the "tabular_note_type" has many subtypes including: "tabular note section subtype", "tabular note subtype", "tabular note row subtype", etc etc. When you cycle through the "tabular note type", you get all the "tabular note objects" regardless of subtype. If you want only the tabular notes, you'll need to check the object's subtype as well.

The "DeleteTabularNotes" sub in the following link shows how to check the subtype, get a tabular note object given its tag, and use the object to check its layer.

http://nxjournaling.com/content/exporting-tabular-note-row

So I already found that thread and I am using the find tabular notes code from it. How do I refine that to find the whole table elements and not those sub elements? Forgive me but I am not sure how the information is structured and I am having a hard time finding examples of structures.