Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
rhasell
in reply to: J_Dumont

Hi

When you mention "Assembly BOM" what are you referring to?

 

The above rule will sort the "Structured" list only, try the following to add Parts as well.

The rule sorts on "Stock Number" change that to suit your BOM, EG: "Part Number" or "Description"

 

' Set a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

' Set a reference to the BOM
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM

oBOM.StructuredViewFirstLevelOnly = False ' Display All levels
oBOM.StructuredViewEnabled = True
oBOM.PartsOnlyViewEnabled = True
Dim oStructuredBOMView As BOMView
oStructuredBOMView = oBOM.BOMViews.Item("Structured")

' Set a reference to the "Parts Only" BOMView
Dim oPartBOMView As BOMView
oPartBOMView = oBOM.BOMViews.Item("Parts Only")

Call oStructuredBOMView.Sort("Stock Number", True)
oPartBOMView.Sort("Stock Number",True) 
Call oPartBOMView.Renumber(1, 1)
Call oStructuredBOMView.Renumber(1, 1)
MessageBox.Show("Done", "Sort BOM")

 

Reg
2025.2