03-26-2020
04:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-26-2020
04:17 PM
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
2025.2