Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save stephensmitchell/a9cf834ba621aa2417d5f32addfa2802 to your computer and use it in GitHub Desktop.

Select an option

Save stephensmitchell/a9cf834ba621aa2417d5f32addfa2802 to your computer and use it in GitHub Desktop.
List All Parts in an Assembly and Sub Assemblies
#https://help.alibre.com/articles/#!alibre-help-v28/list-all-parts-in-an-assembly-and-sub-assemblies
# 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment