Create new column in BOM automatic

Create new column in BOM automatic

buitrongcuongypbn2000
Participant Participant
242 Views
1 Reply
Message 1 of 2

Create new column in BOM automatic

buitrongcuongypbn2000
Participant
Participant

buitrongcuongypbn2000_0-1691677397086.png

Hello everyone,

I have a problem about BOM in Inventor. I want to create some columns automatic by VBA code or something like that. If you have the solutions, you can share for me.

Thank you very much!

0 Likes
243 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @buitrongcuongypbn2000.  We do not have control of the columns included in the assembly's BOM from Inventor's API/iLogic/VBA.  Another way to achieve what you seem to want would be to prepare the BOM the way you want it first, then export that customization out to an XML file.  Then when you want to use that customization again, import that exported XML file again.  Here is a very simple iLogic rule for either exporting or importing the BOM customization.  But you would have to change the specified file path & name to suit your specific needs.

Sub Main
	If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
		MsgBox("An Assembly Document must be active for this rule to work. Exiting.", vbCritical, "")
		Exit Sub
	End If
	Dim oADoc As AssemblyDocument = ThisDoc.Document
	Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
	Dim sBOMTemplate As String = "C:\Temp\MyBOMTemplate.xml"
	'oBOM.ExportBOMCustomization(sBOMTemplate)
	oBOM.ImportBOMCustomization(sBOMTemplate)
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes