×
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

Getting the part name

Getting the part name

Getting the part name

(OP)
Hi!

I have an Object that includes different parts. How is it possible to get those parts names?
A Little example:

theSession = Session.GetSession()
workPart = theSession.Parts.Work
displayPart = theSession.Parts.Display
MsgBox(workPart.name)

Thank you very much!

RE: Getting the part name

To get the full path of the file use: workPart.FullPath
To get the name of the file use: workPart.Leaf

www.nxjournaling.com

RE: Getting the part name

(OP)
Thank you very much for your response! I am using NX as a Virtual Application, therefore debugging with VB using NX is not possible. I have problems understanding the class hierarchy, for example I need to get the parent of a part. In Catia I have the option to directly access the parent with product.parent or product.parent.parent. Does a documentation of the class hierarchy exist online for free?

RE: Getting the part name

In the NX object model there are part objects and component objects (among many others); parts do not have parents, components do. If you have a reference to a component, you can use compRef.Parent, which will return another component reference (the parent) or a null reference (the component doesn't have a parent, or it is not loaded in session).

If you have a reference to a part object, you can use the .ComponentAssembly property to query what components the part references, if any.

If you have a valid NX license, you can download the help files (if you don't have them already) from the GTAC website.

www.nxjournaling.com

RE: Getting the part name

(OP)
Thank you for your answer.
I am finaly able now to use the Debugger. I saw that there is the Option "OwningComponent" and "DirectOwner". What is the difference between parent and that?

RE: Getting the part name

In the context of components, .OwningComponent and .Parent are essentially the same, they both return a reference to a Component object (the next level up, if there is one); .DirectOwner will return a reference to the ComponentAssembly object that the component belongs to.

www.nxjournaling.com

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