×
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

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

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

RE: what's the correct synax to loop through each tabular notes on drawing

The .net API has started adding support for tabular notes in recent versions, each version seems to add more functionality. If you are running NX 8 or above, you can access a collection of "Table" objects and "TableSection" objects with syntax that looks like:

CODE

myPart.Annotations.Tables
myPart.Annotations.TableSections 

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

(OP)
WOW, the tabular note is more complex than what i think here is what i learned:

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....

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