Inventor General Discussion

Inventor General Discussion

Active Member
Posts: 6
Registered: ‎12-01-2010
Message 1 of 4 (500 Views)
Accepted Solution

Populating an existing spreadsheet with BOM data using iLogic

500 Views, 3 Replies
12-06-2010 12:33 PM

I already have a cut list  template in Excel that calculates my stock material,  volume,  etc when I populate the appropriate fields. It is also connected to an access database that has various information that automatically generates the final price of my product based on various suppliers prices and data with whom I do business with and so on.


I would like to know if there was a way with iLogic to make Inventor populate specific cells with information found in the BOM such as: description; Qty and custom iProperties value like dimensions, etc?


The reason why I'm making a new topic out of this is that I have read previous post about the issue, but they were regarding "exporting the BOM to an excel". I, on the other hand, would like to populate an already existing spreadsheet with data from the BOM

After exploring the iLogic snippets, I've only found the "export" option. It referenced the API snippets, but with limited programming knowledge there is not much I can understand.



Thank you in advance. 


Posts: 959
Registered: ‎02-24-2009
Message 2 of 4 (477 Views)

Re: Populating an existing spreadsheet with BOM data using iLogic

12-06-2010 06:26 PM in reply to: Herve_l

You should be able to use code from this sample rule:


Dim bomFileName As String = ThisDoc.ChangeExtension(".xls")
ThisBOM.Export("Parts Only", bomFileName, kMicrosoftExcelFormat)

GoExcel.Open(bomFileName, "Sheet1")
Dim excelSheet = GoExcel.Application.ActiveWorkbook.ActiveSheet
Dim valArray As Array = CType(excelSheet.UsedRange.Value, Array)

Dim outputFileName As String = IO.Path.Combine(ThisDoc.Path, "CopiedBom.xls")

GoExcel.Open(outputFileName, "Sheet1")
For row As Integer = 1 To valArray.GetUpperBound(0)
If (valArray(row,1) = Nothing) Then Exit For
For columnIndex As Integer = 1 To valArray.GetUpperBound(1)
Dim column As String = Chr(Asc("A"c) + columnIndex-1)
'Trace.WriteLine("column = " & column)
GoExcel.CellValue(outputFileName, "Sheet1", column & row) = valArray(row, columnIndex)

This will export the BOM and then read all the data and copy it to another Excel file (CopiedBom.xls, which must already exist).  You can adapt it to extract the data you want (from valArray) and copy it to specific cells in the output sheet.


Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Active Member
Posts: 6
Registered: ‎12-01-2010
Message 3 of 4 (465 Views)

Re: Populating an existing spreadsheet with BOM data using iLogic

12-06-2010 10:39 PM in reply to: MjDeck

Thank you.

I understand the general process now

New Member
Posts: 1
Registered: ‎08-22-2012
Message 4 of 4 (174 Views)

Re: Populating an existing spreadsheet with BOM data using iLogic

12-12-2012 04:12 AM in reply to: MjDeck

I would like to do exactly the same, but as i'm a complete newby in writing code, and so i have problems with adjusting the code to my preferances.


I need to be able to write from the BOM-list only the 'Partnumbers' from 'assembly A' to 'row 4, column E' on 'Sheet1', and 'Assembly B' to the same cells, only on 'Sheet2'.


I tried multiple times to adjust this myself, but the lack of experiance gets me nowhere right now.


Could you point me in the right direction?



Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.