Complete the code to insert a BOM table into the active drawing.
Dim swDraw As ModelDoc2 Dim swBOMTable As BomTableAnnotation Set swDraw = swApp.ActiveDoc Set swBOMTable = swDraw.InsertBomTable2([1], 0, 0, "", swBomTableAnchorType_e.swBomTableAnchorType_TopLeft, 0, 0, False, False)
The InsertBomTable2 method requires the BOM type as the first argument. swBomType_e.swBomType_PartsOnly inserts a parts-only BOM.
Complete the code to set the BOM table to show quantities.
Dim swBOMTable As BomTableAnnotation ' Assume swBOMTable is already set swBOMTable.ShowQuantity = [1]
The ShowQuantity property expects a Boolean value. Setting it to True enables quantity display.
Fix the error in the code to get the BOM table from the drawing sheet.
Dim swSheet As Sheet
Dim swBOMTable As BomTableAnnotation
Set swSheet = swDraw.GetCurrentSheet()
Set swBOMTable = swSheet.GetBomTable([1])The GetBomTable method uses zero-based index. Use 0 to get the first BOM table.
Fill both blanks to set the BOM table's configuration and update it.
swBOMTable.Configuration = [1] swBOMTable.UpdateTable( [2] )
Set the BOM configuration to the string "Default" and call UpdateTable with True to refresh the BOM.
Fill all three blanks to create a BOM, set its type, and anchor it to the top-left.
Set swBOMTable = swDraw.InsertBomTable2([1], 0, 0, "", [2], 0, 0, [3], False)
Use swBomType_e.swBomType_PartsOnly for the BOM type, swBomTableAnchorType_e.swBomTableAnchorType_TopLeft to anchor the BOM, and True to show balloon annotations.
