Option for assembly BoM

Hi,  how do I activate the option "swDisplay_AllConfigurationOfSamePart_AsOneItem" on an assembly BoM?

I would be grateful for a code snippet.

Thx, Miro

 

 

Answers 3
JS
JS 2026-02-05

VBA below.  Edited for all Document types.

'by John R. Sitek
'04-FEB-2026
'This macro loops features to set the BOM Grouping
Option Explicit

Sub Main()

Dim swApplication As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim vbFeatures As Variant
Dim vbFeature As Variant

Set swApplication = Application.SldWorks
Set swModel = swApplication.ActiveDoc
vbFeatures = swModel.FeatureManager.GetFeatures(False)

'Loop features
For Each vbFeature In vbFeatures
  If vbFeature.GetTypeName2 = "BomFeat" Then
      vbFeature.GetSpecificFeature2.PartConfigurationGrouping swDisplay_AllConfigurationOfSamePart_AsOneItem
  End If
Next vbFeature

End Sub

MW
MW 2026-02-05

Hi John, thanks for your reply. However, it applies to drawings and doesn't work for assemblies. But you put me on the right track: I had to go through the subfeatures of TableFolder to find my BomFeat. Thank you very much.

MW
MW 2026-02-09

Thank you very much, it works!