what's the correct synax to loop through each tabular notes on drawing
what's the correct synax to loop through each tabular notes on drawing
(OP)
i try to identify the name of each tabular note table on drawing, so i find the following and try to add the last two lines:
'edit tab note cell text revised by me
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Windows.Forms
Imports System.Environment
Module find_name_of_tabular
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = NXOpen.UF.UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
Dim displayPart As Part = theSession.Parts.Display
lw.Open()
Dim workPartTag As NXOpen.Tag = displayPart.Tag
For Each tabularNote As NXOpen.Tag In workPartTag
error is: expression of nxopen.tag is not a collection of type
i just try to mimic the way i did for note which is: or Each theNote As Note In displayPart.Notes
but here it doesnt work.
what will be the correct way to state For...each....in ? thanks
'edit tab note cell text revised by me
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Windows.Forms
Imports System.Environment
Module find_name_of_tabular
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = NXOpen.UF.UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
Dim displayPart As Part = theSession.Parts.Display
lw.Open()
Dim workPartTag As NXOpen.Tag = displayPart.Tag
For Each tabularNote As NXOpen.Tag In workPartTag
error is: expression of nxopen.tag is not a collection of type
i just try to mimic the way i did for note which is: or Each theNote As Note In displayPart.Notes
but here it doesnt work.
what will be the correct way to state For...each....in ? thanks





RE: what's the correct synax to loop through each tabular notes on drawing
CODE
I've not done much work with them yet, you may want to check the GTAC solution center to see if there are any code snippets to help you.
Also, you can loop through the existing tabular notes with the UF functions. Some examples can be found here:
http://nxjournaling.com/?q=content/change-font-dra...
http://nxjournaling.com/?q=content/exporting-tabul...
http://nxjournaling.com/?q=content/find-tabular-no...
P.S. I would advise against using a variable named workPartTag to reference the tag of the display part. The work part and the display part may refer to the same part, but may refer to 2 separate parts.
www.nxjournaling.com
RE: what's the correct synax to loop through each tabular notes on drawing
the following codes are grabbed from GTAC
Dim nm_rows As Integer
Dim nm_cols As Integer
Dim tabular_note As NXOpen.Tag
'here, these two lines of codes will change the value of nm_cols and nm_rows nxopenSession.Tabnot.AskNmColumns(tabular_note, nm_cols)
nxopenSession.Tabnot.AskNmRows(tabular_note, nm_rows)
MessageBox.Show("Columns:" & nm_cols.ToString() & Newline _
& "Rows:" & nm_rows.ToString())
==================================================================================
'here, col and row is defined as Tag Dim row As NXOpen.Tag
Dim col As NXOpen.Tag
Dim cell As NXOpen.Tag
' the "row" and "col" has nothing to do with anythign but just stay there?
'the 0 and 0 are the actual index of the table! nxopenSession.Tabnot.AskNthRow(tabular_note, 0, row)
nxopenSession.Tabnot.AskNthColumn(tabular_note, 0, col)
nxopenSession.Tabnot.AskCellAtRowCol(row, col, cell)
nxopenSession.Tabnot.SetCellText(cell, "Unrecyclable Styrofoam")
cowski, i borrowed your code which is the change of font code and i did the following tesing
or Each tableNote As Tag In myTabularNoteTags
'Dim tablenote As Tag
Dim title As String = "table"
Dim row As Tag
Dim col As Tag
Dim cell As Tag
theUfSession.Tabnot.AskNthRow(tableNote, 0, row)
theUfSession.Tabnot.AskNthColumn(tableNote, 0, col)
theUfSession.Tabnot.AskCellAtRowCol(row, col, cell)
theUfSession.Tabnot.SetCellText(cell, title)
Next
as you see, i revised your for loop JUST want to do what i plan to do, change some text in the cell!!!! It's successful!!
now the question now is i want to find out the name of the table, i searched the intellisense, but didnt get any luck
i doubt i has somethign to do with theUfSession.Tabnot.AskCellText
i guess if askcelltext returns a string matches with what i define in another string like "table 1"
then i can import data....