Link Part Name
Link Part Name
(OP)
I am sure this is an easy one, but I am stumped. I am looking for a way to tie the part name to our title block. Kind of like linking to attributes using <W@attribute>, but where attribute is I would like it to link to the Leaf name. Any help would be appreciated.
We are using NX3, with no Teamcenter.
Thanks
We are using NX3, with no Teamcenter.
Thanks





RE: Link Part Name
I tried running the .vb file with a macro, so I could incorporate it into a toolbar, and it doesn't work. Is there a way to add the .vb to a toolbar button?
RE: Link Part Name
Journal Files (.vb)
User Function (.dll)
System Command
User Tools (.utd)
Macros (.macro)
GRIP (.gx)
KF Application (.dfa)
John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/
RE: Link Part Name
RE: Link Part Name
RE: Link Part Name
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
http://eng-tips.com/viewthread.cfm?qid=187186
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
RE: Link Part Name
"prototype.SetAttribute("FILENAME",prototype.Leaf)"
Below the do stuff section??
Mark Benson
Aerodynamic Model Designer
RE: Link Part Name
That seemed to do it.
RE: Link Part Name
RE: Link Part Name
John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/
RE: Link Part Name
RE: Link Part Name
&USERID
John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/