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

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