Skip to main content
1-Visitor
May 22, 2018
Question

List all components from assembly using API

  • May 22, 2018
  • 1 reply
  • 1757 views

i all,

 

I would like to list out all the parts in assembly (including parts from sub assemblies) using VB API.I face problem in the following line

 

compath = (New CMpfcAssembly).CreateComponentPath(assembly, currentlevel) 
currentComponent = compath.Leaf

 

when I use this code I could not get the path of current component, it always refers to toplevel assembly.

Throw some light on this

 

1 reply

RPN
18-Opal
May 22, 2018

In my point of view you don't need a component path. Visit the assembly by components, if you found an assembly, call the function recursively. An couple of arrays by level including the count would help later, and for each component found, and as well a tag for already visited assemblies. As a result you may have all path information for each component feature 🙂