Retrieve the list, hierarchy level, and quantity of components in a solidworks VBA assembly

Hello

The need is: I open an assembly file in solidworks 2018 SP5, I click on the  macro button, I have the list, the hierarchical level and the quantity of the components of the assembly in an array variable or in debug print

Can you help me find these functions?

Thank you

Kind regards

1 Like

Hello

Try with this example. We will certainly have to adapt.
Give us feedback. We'll help you...

3 Likes

Hi Remrem,

Thank you for your interesting answer.

The macro generates the XML from the BOM of the drawing . I don't use this nomenclature because we use the EPDM nomenclature.

I would have to find the solution to generate the list from the feature manager of the assembly!

 

Hello @s.marie

In addition to the @remrem idea (which I welcome), here is a solution proposed these days by @JeromeP  https://www.lynkoa.com/forum/solidworks/exportation-vba-nomenclature-solidworks-vers-excel. However, this is not from the BOM EPDM but by comparing the code of the two proposals you should achieve your goals.

Kind regards

1 Like

Hello

Why not go and get the BOM directly in Epdm, see HERE.

Otherwise there is the possibility to create a BOM in the assembly, extract it to Excel (or other) and then delete this BOM, to do this see the link given by Zozo_mp or the macro given HERE by adding the rows to delete the BOM at the end of the processing.

Otherwise, by going through the analysis of the Feature Manager you have this example that can help you.

Kind regards

4 Likes

Thank you for your answers which allowed me to find a solution.

I also relied on this link

https://www.codestack.net/solidworks-api/document/assembly/components/get-visible/