Message 1 of 4
How to Export BOM Rows in Structured Order Based on Item Number?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am trying to export the rows of a Structured BOM from Autodesk Inventor in the order of Item Number that I have already configured in the BOM. However, when I run my code, the rows do not export in the expected order.
Here is my code:
Sub Main
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oBOM As BOM = oAsmDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
Dim oBOMView As BOMView = oBOM.BOMViews.Item("Structured")
Call QueryBOM(oBOMView.BOMRows)
End Sub
Public Sub QueryBOM(oBOMRows As BOMRowsEnumerator)
Static CurrenrRow As Integer = 3
Dim i As Integer
For i = 1 To oBOMRows.Count
Dim oRow As BOMRow = oBOMRows.Item(i)
Dim oCompDef As ComponentDefinition = oRow.ComponentDefinitions.Item(1)
MsgBox(oRow.ItemNumber & "_" & System.IO.Path.GetFileName(oCompDef.Document.FullFileName))
If Not oRow.ChildRows Is Nothing Then
Call QueryBOM(oRow.ChildRows)
End If
Next
End Sub