Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA /ilogic code to set columns in bom

9 REPLIES 9
Reply
Message 1 of 10
j_r_a_koning
2021 Views, 9 Replies

VBA /ilogic code to set columns in bom

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.

9 REPLIES 9
Message 2 of 10

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

Message 3 of 10
j_r_a_koning
in reply to: j_r_a_koning

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

Message 4 of 10

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

Any update in this matter?
BOM API
Message 6 of 10

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

@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. 

Message 8 of 10
JBerns
in reply to: jakub.struszczyk

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 Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 9 of 10
jakub.struszczyk
in reply to: JBerns

@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.  

 
Message 10 of 10
JBerns
in reply to: jakub.struszczyk

@jakub.struszczyk,

 

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 Inventor 2022
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report