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.
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.
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
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.
As far as I know, situation is still the same in Inventor 2016 ... 😞
@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.
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
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