Thank you both for your help.
@Andrii_Humeniuk
Your code works great to generate the Structured excel sheet exactly as the export tool does, and I will definitely use it. I just have to remember to sort the list before running the rule (if you can add some code the will sort by Part Number and then renumber the list, then all will be right with the world!) It does not, however, generate a sheet based upon the Model Data tab. I thought by changing the "2" in this line:
Dim oModelBOM As BOMView = oAsmDoc.ComponentDefinition.BOM.BOMViews(2)
to a "0" would trick the code, but Inventor was not happy with that...
@Michael.Navara
Your code is comprehensive and publishes all levels of the assembly, especially the "Level 0" data, which is exactly what I need to access. However, the exported sheet needs to be formatted like the "Structured" or "Parts Only" versions, but with the Model Data entries and columns only. I have no clue how to modify your code to accomplish this.
The issue I am trying to solve resolves around a client's request. We have developed numerous configurations of his product in one assembly as asked for. He needs to see an Excel BOM (A) that includes all of the configurations (22 and rising). He also wants a BOM (B) that shows only the sub-assemblies, and finally, he wants a BOM (C) for parts only. I can generate A & C or B & C, but not A, B & C from the assembly. My workaround so far is:
- For BOM A, set the BOM Structure on the Bill Of Materials to "Normal" and export the "Structured" tab
- For BOM B, set the BOM Structure on the Bill Of Materials to "Phantom" and export the "Structured" tab
- For BOM C, the BOM Structure setting is irrelevant. Export the "Parts Only" tab
One other possible option I see is to have line(s) in the code that will set the BOM Structure as needed for the export, and then reset it.
Thank you again.