InsertBomTable3 multi configurations

Hi all

On a SolidWorks assembly, with the VBA command "InsertBomTable3" and a few lines of code, you can insert the BOM of an assembly configuration on a chosen view. But how do you display, with VBA commands, the nomenclature of several configurations as is possible on the SW interface?
Indeed, on SolidWorks, when you insert a BOM table, it is possible to choose the table model, the BOM type, the type of grouping but also the configurations you want to display (as explained here ). Thus, the added BOM has as many "quantity" columns as there are configurations, and all the parts of the assembly are listed.
I have made several attempts, including recording a macro, but I can't find the command or the succession of commands that allow you to display the same thing in VBA as directly on the interface.
Do you have a solution to this question?
Thomas

Hello @t.soulard, Good evening Thomas :grinning:

Happy to see you on the forum and to welcome you.

I hope that we can help you solve a few problems on a regular basis, but also that we can benefit from your knowledge and experience.

We have on our forum a super strong VBA guy who will answer you quickly!

Kind regards

1 Like

Hello @tous
Possible for the top_level with the "setconfigurations" function of
"bomfeature" Example

2 Likes

Here the options available for:
IBomFeatures:
https://help.solidworks.com/2022/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IBomFeature_members.html?id=57845b2c38d74d48a28ce6088236d074#Pg0
IBomTable:
https://help.solidworks.com/2022/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IBomTable_members.html?id=8da3b33e278a402d8d5020ee6ea63ebb#Pg0

1 Like

Hello
Thank you for your answers. I'm going to try to spend some time today to study them and implement them in my program which works directly on the 3D and not on the drawing.

Hello sbadenis,
Thank you for the IBomFeatures track which was the right one.
I used GetConfigurations to know all the configurations that can be put on the name and then SetConfigurations to make them appear.

In the end my code is as follows.
Set swBOMAnnotation = swModelDocExt.InsertBomTable3(TemplateName, 0, 0, BomType, Configuration, False, swNumberingType_Detailed, True)
Set swBOMFeature = swBOMAnnotation.BomFeature
ConfigS_Nom = swBOMFeature.GetConfigurations(False, Visible)
boolstatus = swBOMFeature.SetConfigurations(True, True, ConfigS_Nom)

Thank you for your help

Self-validated S is not nice

1 Like