Showing results for 
Search instead for 
Do you mean 

Is part a component of another part

Is there a simple way of finding if a part in the session is a child/component of another part?

Currently I'm having to get all components of each part in the session and then lookup if the part of interest is in the my list of known components which seems a little long winded.




Re: Is part a component of another part

There should be Information => Assemblies => Where used, which you could try to record a journal of.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 ( | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: Is part a component of another part

Are you concerned with just the parts in the session, or anywhere?

TC or Native?


If anywhere/native, you could use the ugpc.exe on all files & parse the output

If anywhere/TC, where used can show things (may assume PSE is correct for all parts)



Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled

Re: Is part a component of another part

Hi Stefan,


Thanks for your suggestion.  I've given that a go but it's not supported (at least in NX8.5 that I'm running)

I was thinking along the lines of getting the occurance of the part or casting the part to a component to allow me to then get the parent.

I'm only interested in the parts in the session.


Re: Is part a component of another part

[ Edited ]

At the moment this is what I'm doing:

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Imports System.Collections.Generic

Module Module1
    Dim comp_list As New List(Of String)
    Dim parts_list As New List(Of String)
    '  Explicit Activation
    '      This entry point is used to activate the application explicitly
    Sub Main()

        Dim theSession As Session = Session.GetSession()

        Dim ufs As ufsession = ufsession.getufsession()
        Dim theUI As UI = UI.GetUI()
        Dim lw As ListingWindow = theSession.ListingWindow


        For Each my_part As Part In theSession.Parts


            Dim ca As ComponentAssembly = my_part.ComponentAssembly

                Walk(ca.RootComponent, 0)
            Catch ex As Exception

            End Try

        For Each my_part As String In parts_list

            If comp_list.Contains(my_part) Then
            End If

    End Sub
    Sub Walk(ByVal c As Component, ByVal level As Integer)

        Dim children As Component() = c.GetChildren()
        Dim child As Component
        Dim prototype As Part

            For Each child In children
                Dim child_part As Part
                If TypeOf child.Prototype Is Part Then
                    child_part = CType(child.Prototype, Part)
                End If

                Walk(child, level + 1)

     End Sub

End Module


This shows the parts that are top level assys, which is ultimately what I'm trying to achieve. 

Re: Is part a component of another part

Have you tried using this:


It sounds like it could be just what you need.

Note that there are VB/C#/Java wrappers for it.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5