Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@Darkforce_the_ilogic_guy 

Try this. You can edit the properties that you want to copy and add more in the BOLD part in code.

 

Class BOMEXport
	Shared row As Integer = 5
Public Sub Main()

Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM

oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = False
oBOM.StructuredViewDelimiter = "."

oBOM.PartsOnlyViewEnabled = True

Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("Structured")

Call ExportToExcel(oBOMView.BOMRows)

End Sub

Public Function ExportToExcel(bRows As BOMRowsEnumerator)
ExcelFile ="C:\SolidCAD\Inventor Training Files\iLOGIC\Beam\Beam Assembly - BOM.xlsx"
ExcelSheet = "TEST"


GoExcel.CellValue(ExcelFile,ExcelSheet,"B4") = "Item"
GoExcel.CellValue(ExcelFile,ExcelSheet,"C4") = "QTY"
GoExcel.CellValue(ExcelFile,ExcelSheet,"D4") = "DESC"
GoExcel.CellValue(ExcelFile,ExcelSheet,"E4") = "Part Number"
GoExcel.CellValue(ExcelFile,ExcelSheet,"F4") = "G_L (Custom)" 'add more line below as per your property requirement Dim bRow As BOMRow For Each bRow In bRows Dim rDoc As Document rDoc = bRow.ComponentDefinitions.Item(1).Document Dim docPropertySet As PropertySet docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties") GoExcel.CellValue(ExcelFile,ExcelSheet,"B" & row) = bRow.ItemNumber GoExcel.CellValue(ExcelFile,ExcelSheet,"C" & row) = bRow.ItemQuantity GoExcel.CellValue(ExcelFile,ExcelSheet,"D" & row) = docPropertySet.Item("Description").Value GoExcel.CellValue(ExcelFile,ExcelSheet,"E" & row) = docPropertySet.Item("Part Number").Value 'add more line below as per your property requirement row = row + 1 If Not bRow.ChildRows Is Nothing Call ExportToExcel(bRow.ChildRows) End If Next GoExcel.Save GoExcel.Close GoExcel.ClearCache End Function End Class  

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn