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
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
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