Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Not a tabular note......

$
0
0

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.GenericImports 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 AsNew 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 AsInteger=0
        theUfSession.Tabnot.AskNmSections(myTabNotes.Item(0), numSections)
        lw.WriteLine("Number of sections in tabular note: "& numSections.ToString) 
        Dim numRows AsInteger=0
        theUfSession.Tabnot.AskNmRows(myTabNotes.Item(0), numRows)
        lw.WriteLine("Number of rows in tabular note: "& numRows.ToString) 
        Dim numCols AsInteger=0
        theUfSession.Tabnot.AskNmColumns(myTabNotes.Item(0), numCols)
        lw.WriteLine("Number of columns in tabular note: "& numCols.ToString)
        lw.WriteLine("") 
        Dim rowTag As Tag =NothingDim colTag As Tag =NothingDim cellTag As Tag =Nothing 
 
	   Dim labelTables AsNew List(Of Tag) 
	   For z AsInteger=0To 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 AsString=""Dim evalCellText AsString=""
                theUfSession.Tabnot.AskCellText(cellTag, cellText)
                theUfSession.Tabnot.AskEvaluatedCellText(cellTag, evalCellText) 
			if cellText ="IMPLANT COMPONENTS"Then 
				labelTables.Add(myTabNotes.Item(z))EndIf 
	   Next 
 
    EndSub 
 
    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.NullThenContinueDoEndIfIf tmpTabNote <> NXOpen.Tag.NullThen 
                tagList.Add(tmpTabNote) 
            EndIfLoop Until tmpTabNote = NXOpen.Tag.Null 
    EndSub 
EndModule

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>