Hi @Anonymous,
Try the following suggestion to customize BOM.
https://www.cadlinecommunity.co.uk/hc/en-us/articles/203364071-Inventor-2017-Quick-Tip-BoM-Customisa...
To import customized BOM, try the following VBA code to import.
Sub BOM_ColumnCustomizasion_Export ()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oAsmDoc.ComponentDefinition
Dim oBOM As BOM
Set oBOM = oAsmDef.BOM
Dim filename As String
filename = "c:\temp\BOM_Columns.xml"
Call oBOM.ExportBOMCustomization(filename)
Beep
End Sub
Sub BOM_ColumnCustomizasion_Import ()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oAsmDoc.ComponentDefinition
Dim oBOM As BOM
Set oBOM = oAsmDef.BOM
Dim filename As String 'assume the file exists
filename = "c:\temp\BOM_Columns.xml"
Call oBOM.ImportBOMCustomization(filename)
Beep
End Sub
After importing BOM, try to export BOM using following VBA code.
Public Sub BOMExport()
' Set a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
' Set a reference to the BOM
Dim oBOM As BOM
Set oBOM = oDoc.ComponentDefinition.BOM
' Set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False
' Make sure that the structured view is enabled.
oBOM.StructuredViewEnabled = True
' Set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView
Set oStructuredBOMView = oBOM.BOMViews.Item("Structured")
' Export the BOM view to an Excel file
oStructuredBOMView.Export "C:\temp\BOM-StructuredAllLevels.xls", kMicrosoftExcelFormat
End Sub
Hope, this would help you to import assembly with Parent Part Number.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network