04-06-2022
05:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-06-2022
05:32 AM
Sub Main
Dim oAss as AssemblyDocument
oAss= ThisApplication.ActiveDocument Dim oBOM As BOM oBOM = oAss.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = False
Dim oBOMView as BOMView
oBOMView = oBOM.BOMViews.Item("Structured")
Dim oRow as BOMRow
For Each oRow in oBOMView.BOMRows
'do stuff
qty = oRow.ItemQuantity
Call RecurseBOMRow(oRow)
Next
End Sub
Sub RecurseBOMRow(oRow as BOMRow)
For Each oRow In oRow.ChildRows
'do stuff
qty = oRow.ItemQuantity
If Not oRow.ChildRows Is Nothing
Call RecurseBOMRow(oRow)
End If
Next
End Sub
I didn't quite understand what you were wanting but this is a simple version that goes through each row in the structured BOM, checks if it has child rows and goes through them, and gets the item quantity.