i first recorded the journal to see what code it will give to you if i try to modify the title of attribute. then i get the code and modify it with my understanding
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports System.Environment
Module replace_tabular_note_experiment
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work
Dim theUI As UI = UI.GetUI()
Sub Main()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim myTabularNoteTags As New List(Of Tag)
If FindTabularNotes(myTabularNoteTags) = 0 Then
'no tabular notes to process
Return
End If
For Each tableNote As Tag In myTabularNoteTags
Dim obj(0) As NXObject
Dim tableSection As Annotations.TableSection = CType(workPart.Annotations.TableSections.FindObject("tableNote"), Annotations.TableSection)
obj(0) = tableSection
Dim attribute As AttributePropertiesBuilder
attribute = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, obj, AttributePropertiesBuilder.OperationType.None)
Dim titleName As String = attribute.Title
lw.WriteLine(titleName)
Exit Sub
Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer
Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
Dim type As Integer
Dim subtype As Integer
Do
theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
If tmpTabNote = NXOpen.Tag.Null Then
Continue Do
End If
If tmpTabNote <> NXOpen.Tag.Null Then
theUfSession.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
If subtype = UFConstants.UF_tabular_note_subtype Then
theTabNotes.Add(tmpTabNote)
End If
End If
Loop Until tmpTabNote = NXOpen.Tag.Null
Return theTabNotes.Count
End Function
error is no objects is found with this name "tableNote". the "tableNote" is right click property general tab and revise the name there
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports System.Environment
Module replace_tabular_note_experiment
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work
Dim theUI As UI = UI.GetUI()
Sub Main()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim myTabularNoteTags As New List(Of Tag)
If FindTabularNotes(myTabularNoteTags) = 0 Then
'no tabular notes to process
Return
End If
For Each tableNote As Tag In myTabularNoteTags
Dim obj(0) As NXObject
Dim tableSection As Annotations.TableSection = CType(workPart.Annotations.TableSections.FindObject("tableNote"), Annotations.TableSection)
obj(0) = tableSection
Dim attribute As AttributePropertiesBuilder
attribute = theSession.AttributeManager.CreateAttributePropertiesBuilder(workPart, obj, AttributePropertiesBuilder.OperationType.None)
Dim titleName As String = attribute.Title
lw.WriteLine(titleName)
Exit Sub
Function FindTabularNotes(ByRef theTabNotes As List(Of Tag)) As Integer
Dim tmpTabNote As NXOpen.Tag = NXOpen.Tag.Null
Dim type As Integer
Dim subtype As Integer
Do
theUfSession.Obj.CycleObjsInPart(workPart.Tag, UFConstants.UF_tabular_note_type, tmpTabNote)
If tmpTabNote = NXOpen.Tag.Null Then
Continue Do
End If
If tmpTabNote <> NXOpen.Tag.Null Then
theUfSession.Obj.AskTypeAndSubtype(tmpTabNote, type, subtype)
If subtype = UFConstants.UF_tabular_note_subtype Then
theTabNotes.Add(tmpTabNote)
End If
End If
Loop Until tmpTabNote = NXOpen.Tag.Null
Return theTabNotes.Count
End Function
error is no objects is found with this name "tableNote". the "tableNote" is right click property general tab and revise the name there