Lists all the parts in an assembly and all the parts in sub-assemblies.


*Edit line 10 of the script to reflect the directory path to the main assembly, and the name of the main Assembly


# list all the parts in an assembly and it's sub-assemblies
def ListPartsinAssembly(Assem):
  for P in Assem.Parts:
    print '%s in %s' % (P, Assem)
 
  for SA in Assem.SubAssemblies:
    ListPartsinAssembly(SA)
 
# top-level assembly, replace with your own path
Assem = Assembly(r'C:\Users\<username>\Downloads\ASM', 'Main ASM.AD_ASM')
ListPartsinAssembly(Assem)
Assem.Close()