12-25-2015
02:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-25-2015
02:09 AM
Try this sample please:
Sub BOM_Qty_Test()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oBOM As BOM
Set oBOM = oAsmDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = True
Dim oBOMView As BOMView
Set oBOMView = oBOM.BOMViews.Item("Structured") 'Structured
Dim oBOMRow As BOMRow
Dim TotalQty As Double
TotalQty = 0
For Each oBOMRow In oBOMView.BOMRows
TotalQty = TotalQty + oBOMRow.TotalQuantity
Debug.Print "ItemNumber = " & oBOMRow.ItemNumber & " Qty = " & oBOMRow.TotalQuantity
Next
Debug.Print "Total Qty = " & TotalQty
Beep
End Sub
BOMRow.TotalQuantityOverridden Boolean property could help you to detect if the TotalQuantity property has been overridden.
cheers,
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network