' 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
Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item(2)
' Set a reference to the "Parts Only" BOMView
Call oBOMView.Sort("Part Number", True)
Call oBOMView.Renumber(1, 1)
网友评论