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.
Solved! Go to Solution.
You should be able to use code from this sample rule:
Dim bomFileName As String = ThisDoc.ChangeExtension(".xls")
ThisBOM.Export("Parts Only", bomFileName, kMicrosoftExcelFormat)
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")
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.
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?
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register