×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Link Part Name

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

RE: Link Part Name

(OP)
Ok, I did some searching and was able to make this work using journaling.  
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

Using Customize, when you add a 'User Command' to a toolbar, under 'Edit Action', you can link to any of the following 'executables':

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

(OP)
I got this figured out as well.  I just edited a toolbat to link to the .vb instead of the .macro.

RE: Link Part Name

(OP)
thanks for your help, John.

RE: Link Part Name

(OP)
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

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

Have you tried just adding,

"prototype.SetAttribute("FILENAME",prototype.Leaf)"

Below the do stuff section??

 

Mark Benson
Aerodynamic Model Designer

RE: Link Part Name

(OP)
Thanks Mark,
That seemed to do it.   

RE: Link Part Name

(OP)
I would also like to add the username of the person creating the drawing to the attributes.  Does anyone know how this is referenced?

RE: Link Part Name

That will probably require some type of program.  I know that it can be done with GRIP, and I assume that most of the other programming options should also provide support for this.

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

(OP)
Do you know what the variable is though?  For instance session.parts.work.leaf is the leaf name.  Session.parts.work.(username) is what?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources