HagenT
Mechanical
- Dec 1, 2015
- 14
Hy at all,
i have a little problem with my Journal.
I have a drawing with a lot of id symbols created by the user manuel. Now i whant to modify the part is associated with the symbol.
There is no Attribute created to the part or somthimg else i can identify it. So i need to get it via the id symbol to create an attribute.
I tried it with the following code but didn´t work.
Thanks Hagen
i have a little problem with my Journal.
I have a drawing with a lot of id symbols created by the user manuel. Now i whant to modify the part is associated with the symbol.
There is no Attribute created to the part or somthimg else i can identify it. So i need to get it via the id symbol to create an attribute.
I tried it with the following code but didn´t work.
Code:
Imports System.Collections
Imports NXOpen
Imports NXOpen.Annotations
Imports NXOpen.UF
Public Class test
' class members
Private Shared theSession As Session
Private Shared theUI As UI
Private Shared theUfSession As UFSession
Private Shared lw As ListingWindow
Public Shared Function Main(args As String()) As Integer
theSession = Session.GetSession()
theUI = UI.GetUI()
theUfSession = UFSession.GetUFSession()
lw = theSession.ListingWindow
Try
Dim idCol As IdSymbolCollection = theSession.Parts.Work.Annotations.IdSymbols
Dim ids As IdSymbol
Dim iEnum1 As IEnumerator = idCol.GetEnumerator()
iEnum1.Reset()
While iEnum1.MoveNext()
ids = DirectCast(iEnum1.Current, IdSymbol)
lw.Open()
lw.WriteLine(vbLf & "Symbol: " + ids.Tag.ToString())
Dim idsb As IdSymbolBuilder = idCol.CreateIdSymbolBuilder(ids)
lw.WriteLine(" Text: " + idsb.UpperText)
idsb.Destroy()
lw.WriteLine(" Number of Associativities: " + ids.NumberOfAssociativities)
For i As Integer = 1 To ids.NumberOfAssociativities
Dim assoc As Associativity = ids.GetAssociativity(i)
Dim obj As NXObject = assoc.FirstObject
lw.WriteLine(" Assoc No." + i + ": " + obj.ToString())
lw.WriteLine(" Owning Part: " + obj.OwningPart.FullPath)
If obj.IsOccurrence Then
lw.WriteLine(" Owning Component: " + obj.OwningComponent.Name)
End If
Next
End While
Catch ex As NXOpen.NXException
UI.GetUI().NXMessageBox.Show("Message", NXMessageBox.DialogType.[Error], ex.Message)
End Try
Return 0
End Function
Public Shared Function GetUnloadOption(arg As String) As Integer
Return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately)
End Function
End Class
Thanks Hagen