Extract object attributes from drawing notes

I current have a script that extracts notes out of drawing files, but I am having trouble getting information for object attributes. For example, if a note references another assembly part for it's PART_NAME attribute, I cannot figure out of way to output the note with the actual part name instead of the raw string output, such as <WRef1*0@DB_PART_NAME>.

I'm worried this is not possible since can't seem to figure out a way to relate <WRef1*0@DB_PART_NAME> with the object attribute that it points to. Any insight/advice would very much be appreciated!

Thank you!

The code below should illustrate how to get what you need. It was written by Steve Labout of GTAC.

'Steve Labout
'nx_api4613
'evaluate all note text

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations

Module evaluate_all_note_text

Dim theSession As Session = Session.GetSession()

Sub Echo(ByVal output As String)
theSession.ListingWindow.Open()
theSession.ListingWindow.WriteLine(output)
theSession.LogFile.WriteLine(output)
End Sub

Sub Main()

Dim dp As Part = theSession.Parts.Display
Dim nc As NoteCollection = dp.Notes
For Each a_note As Note In nc

Dim aT As AssociativeText = theSession.Parts.Work.Annotations.CreateAssociativeText()
Dim cData As ComponentData = theSession.Parts.Work.Annotations.CreateComponentData(a_note)

For Each tC As TextComponent In cData.GetTextComponents
Echo(tC.Type.ToString & ": ")
For Each aLine As String In tC.GetText()
Echo(" " & aLine & " => " & aT.GetEvaluatedText(a_note, aLine))
Next

Next

Next

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function

End Module

THANK YOU SO MUCH! This is exactly what I needed.

Would you happen to have something similar for translating feature control frames? I currently have some code that just does string parsing and replacement, but it's not a perfect solution.

Something like <&70><+>C<+><&90> would just be a C in a box. I can keep doing parsing, but I was wondering if there is a method for "reversing" the insertion of symbols into notes?

I'm not aware of any API functionality that will help you parse feature control frame text.