Rearrange Assembly BOM (Structured) Columns/Titles using iLogic

Rearrange Assembly BOM (Structured) Columns/Titles using iLogic

CDuPlessisTQEZQ
Enthusiast Enthusiast
81 Views
1 Reply
Message 1 of 2

Rearrange Assembly BOM (Structured) Columns/Titles using iLogic

CDuPlessisTQEZQ
Enthusiast
Enthusiast

Good day everyone.

 

I'm currently busy making an external rule that will export my assembly to an Excel document with a bunch of small changes.

Currently I'm stuck at the point were I want to "Rearrange" the columns I have active in the "Structured" part of the BOM.

 

What I want to achieve here is that the "Structured" columns/titles should only consist out of the following headers:

• Item

• Part Number

• Filename

• Component Type

• Material

 

Here is my code that I have this far:

' To check if current open document (Active document) is an assembly. (.iam) - Returns a 'true' or 'false' value.
IsAssembly = ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject

' If is .iam then make changes to the BOM Structure.
If IsAssembly = True Then
	Dim AssyDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim AssyBom As BOM = AssyDoc.ComponentDefinition.BOM
	
	AssyBom.StructuredViewEnabled = True
	AssyBom.StructuredViewFirstLevelOnly = False
	AssyBom.StructuredViewDelimiter = "."
	AssyBom.HideSuppressedComponentsInBOM = True
	AssyBom.RenumberItemsSequentially = True
	AssyBom.SetPartNumberMergeSettings2(False)

	' Here I want the rule to rearrange the the titles of the Structured BOM.
	
Else
	MessageBox.Show("Active document is NOT an assembly.", "BOM Check")
End If

 

I'm still learning a lot of new things in regards to using iLogic, and I appreciate all the help.

Current version of Inventor is 2023.

 

CDuPlessisTQEZQ_0-1752499549616.png

 

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

andrii_humeniukCUEER
Explorer
Explorer

Hi @CDuPlessisTQEZQ . The Inventor API does not allow you to customize the BOM view yourself. However, you can export a ready-made BOM table display to an XML file, and then use the BOM.ImportBOMCustomization method to import the table display properties.

' To check if current open document (Active document) is an assembly. (.iam) - Returns a 'true' or 'false' value.
IsAssembly = ThisApplication.ActiveDocument.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject

' If is .iam then make changes to the BOM Structure.
If IsAssembly = True Then
	Dim AssyDoc As AssemblyDocument = ThisApplication.ActiveDocument
	Dim AssyBom As BOM = AssyDoc.ComponentDefinition.BOM
	
	AssyBom.StructuredViewEnabled = True
	AssyBom.StructuredViewFirstLevelOnly = False
	AssyBom.StructuredViewDelimiter = "."
	AssyBom.HideSuppressedComponentsInBOM = True
	AssyBom.RenumberItemsSequentially = True
	AssyBom.SetPartNumberMergeSettings2(False)
	
	AssyBom.ImportBOMCustomization("YourPath")
	
Else
	MessageBox.Show("Active document is NOT an assembly.", "BOM Check")
End If

 

0 Likes