VBA /ilogic code to set columns in bom

VBA /ilogic code to set columns in bom

j_r_a_koning
Participant Participant
2,370 Views
9 Replies
Message 1 of 10

VBA /ilogic code to set columns in bom

j_r_a_koning
Participant
Participant

Hi,

 

At the moment i'm using ilogic code to export a structured bom list to excel for further proces. For this i have to set a specific range of columns in my bom. For all new projects the range of columns is set in the  assembly template file. For older projects i have to do this by hand (see attachment). Is there a piece of vba code that can do this for me.

0 Likes
2,371 Views
9 Replies
Replies (9)
Message 2 of 10

philippe.leefsma
Alumni
Alumni

Hi, The API cannot reorder the BOM columns or modify the export, but you could rely on Excel API to post process your xls files...

 

I hope it helps.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 10

j_r_a_koning
Participant
Participant

Dear Phillippe,

 

Tanks for your reply. Your suggestion is what i do at the moment, but before you can post process the exported list you have to set columns in the bom list for export. I was thinking of a piece of code that does a check if all the columns i need are set in the bom, if not add the columns. This is only for working in older projects (bases on older templates) and for instanse in changes in column names in the future or to set extra columns. it is important that the list of used columns is exact the same by every exported list otherwise i get copied columns with the wrong values. The position of the colums is not important because the exported bom list is sorted A-Z.

It is also more to make is easier for distrubusion of the code to other colleagues so they don't have to think on setting the BOM list.

 

Conclusion is that this is not covered in the API at the moment. So far you now, will the API for adjustments in the BOM list be expanded in the near future and are working with columns one of the potentials?

 

With kind regards,

 

Jeroen

0 Likes
Message 4 of 10

philippe.leefsma
Alumni
Alumni

The BOM manipulation is an area where the API lacks a bit unfortunately. We have wishlist items logged about it in order to expose more flexibility with the API, but I cannot give you any guarantee concerning when the development will be able to implement it, sorry about that.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 5 of 10

Anonymous
Not applicable
Any update in this matter?
BOM API
0 Likes
Message 6 of 10

philippe.leefsma
Alumni
Alumni

As far as I know, situation is still the same in Inventor 2016 ... 😞



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 7 of 10

Anonymous
Not applicable

@j_r_a_koning I found that there is a command to Import xsl with BOM"layout"

You need to place the exported XML from your favorite BOM in known folder; then place one line in code:

Call oBOM.ImportBOMCustomization("C:\EXAMPLE\StansardIAM.xml")

It works fine for me. 

0 Likes
Message 8 of 10

JBerns
Advisor
Advisor

I have searched the Forums and 2019 API Help, but have been unsuccessful.

 

Is there any way to test if a BOM column exists before having to import the BOM customization file?

 

IF BOMcolumn missing THEN

   Import BOM customization file

END IF

 

This could avoid loading unnecessarily. Unless of course, it takes longer to test for column existence than it does to load the customization file.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 9 of 10

Anonymous
Not applicable

@JBerns I'm not "coder" so I base only on forum posts. As it is written above - BOM is not supported very well - so loading xml each time would be easiest for this moment.  

 
0 Likes
Message 10 of 10

JBerns
Advisor
Advisor

@Anonymous,

 

Acknowledged. Thanks for the feedback. I have changed my code to load the XML file each time. A few extra seconds is minor compared to the time it took to perform the manual sorting method. Thanks again.

 

 

Regards,

Jerry 

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes