On this same note,
I have also found a .vb script on this site to make each part of an assembly the work part, and then it writes info about that part to a text window. See link below
also quoted below.
Can anyone provide me with a line of code to add to this in order to add an attribute to each part that is the aprt name, and where I would add it? I have come up with adding:
"part.SetAttribute("FILENAME",prototype.Leaf)" right below the "do stuff here" line in the code below, but that doesn't seem to exactly work. I know this is wordy, but any help would be greatly appreciated once again! Thanks
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Assemblies
Module NXJournal
Dim Session As Session = Session.GetSession()
Sub Walk(c As Component, level As Integer)
Dim children As Component() = c.GetChildren()
Dim child As Component
Dim prototype As Part
If TypeOf c.Prototype Is Part Then
prototype = CType(c.Prototype, Part)
session.ListingWindow.WriteLine(New String(" "C, level) & prototype.FullPath & " " & prototype.Leaf & " " & c.Name)
msgbox("do stuff here") ' add lines to write to a file or an array
For Each child In children
Walk(child, level + 1)
Next
Else
session.ListingWindow.WriteLine(New String(" "C, level) & c.Name & " is not loaded")
End If
end sub
Sub Main
session.ListingWindow.Open
Dim part1 As Part
part1 = session.Parts.Work
Dim c As ComponentAssembly = part1.ComponentAssembly
Walk(c.RootComponent, 0)
End Sub
End Module