Get Arbitrary Note Values inside a Custom Symbol

Hi all,

I am trying with a code below to extract arbitrary note values inside a custom symbol but not successful. Can any one help me in getting this.

Below is the sample file containing custom symbol for testing purpose.
https://goo.gl/ZU7y8O

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
Dim theUI As UI = UI.GetUI()
Dim draftingCustomSymbolBuilder1 As NXOpen.Annotations.DraftingCustomSymbolBuilder
draftingCustomSymbolBuilder1 = workPart.Annotations.CustomSymbols.CreateDraftingCustomSymbolBuilder(CType(theUI.SelectionManager.GetSelectedObject(0), NXOpen.Annotations.CustomSymbol))
draftingCustomSymbolBuilder1.SelectText(0)
Dim arbitrarynotetitle1() As String
arbitrarynotetitle1 = draftingCustomSymbolBuilder1.GetArbitraryNoteTitle()
theSession.listingwindow.open()
theSession.listingwindow.writeline(arbitrarynotetitle1(0))

Dim nXObject1 As NXOpen.NXObject
nXObject1 = draftingCustomSymbolBuilder1.Commit()
draftingCustomSymbolBuilder1.Destroy()

End Sub
End Module

Try the following:

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

Module Module2

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

Sub Main()

If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

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

Dim customSymbolTags As New List(Of Tag)

lw.WriteLine("number of custom symbols in .CustomSymbols collection: " & workPart.Annotations.CustomSymbols.ToArray.Length.ToString)
lw.WriteLine("")

For Each mySymbol As Annotations.CustomSymbol In workPart.Annotations.CustomSymbols

lw.WriteLine("name: " & mySymbol.Name)
lw.WriteLine("symbol name: " & mySymbol.SymbolName)

Dim customSymbolData As Annotations.CustomSymbolData
customSymbolData = mySymbol.GetSymbolData()
lw.WriteLine("angle: " & customSymbolData.Angle)
lw.WriteLine("scale: " & customSymbolData.Scale)
lw.WriteLine("")

Dim symbolBuilder1 As Annotations.DraftingCustomSymbolBuilder = theSession.Parts.Work.Annotations.CustomSymbols.CreateDraftingCustomSymbolBuilder(mySymbol)

Dim listContents() As Annotations.MasterSymbolListItemBuilder
listContents = symbolBuilder1.Texts.GetContents()
For Each temp As Annotations.MasterSymbolListItemBuilder In listContents
lw.WriteLine("note title: " & temp.NoteTitle)
lw.WriteLine("note text: " & temp.NoteText)

Next

lw.WriteLine("")

symbolBuilder1.Destroy()
Next

lw.Close()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Its Perfect. Thank you NXJournaling.

GopinadhGvs