Exporting data into Excel from Inventor using iLogic

Marketing
Marketing
  • Updated

By Chris Smith

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_1.JPG

Introduction

Autodesk Inventor has many ways to store and display information about our products and designs. Knowing how to leverage that data to use in other downstream processes can vastly improve our design processes by reusing information already stored with our designs, ensuring correct information and faster delivery times for our projects.

In this article we will look at extracting information from Inventor to use in Excel. For this example, I will be creating a simple quote based on the iProperty information within each part file.

For this example to work we will be using the costs added to the Estimated Cost iProperty. We can keep these costs up to date by reading the information from an excel spreadsheet and applying it to the iProperties in the files. You can see how to do this in my previous blog - Reading information from excel spreadsheets with iLogic

The files that I will be using for this example are available for download from my Autodesk Drive, here – https://autode.sk/3TAurMn

If you are unable to download the files, the body of the iLogic rule is available below for you to copy and paste into your own rule body.

iLogic Rule

Below is the iLogic rule I will be using for this example.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_2.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_3.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_4.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_5.JPG

iLogic Rule Breakdown

So that we can edit the rule to suit our purpose, we need to understand what the rule is doing. I have added some comments to the rule to help with this, but the next section will break down the rule further.

Section 1 – References and variables

This first section calls the APIs that are needed in the iLogic rule.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_6.JPG

Section 2 – Create an Excel object

This next block of code will create an Excel application object. This will allow the user to use Excel APIs and functions within iLogic. This gives more options that the GoExcel Functions. The comments in the Rule explain these 3 lines.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_7.JPG

Section 3 – Checking for existing files

If we have already created an output file previously for this assembly, we would like to re-use/overwrite this file. Otherwise, we need to create a new file from a template. The next section of code checks for existing files and creates a new one if there is no existing file.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_8.JPG

Section 4 – Creating Data variables

This next section creates variables to store the data we want to transfer to the excel workbook.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_9.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_10.JPG

Section 5 – Cycling through the objects and retrieving data

Now we have set up our rule with variables etc, we now need to tell iLogic what to extract and where to add the data. This next section will loop through each unique item and add a row to the Excel document.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_11.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_12.JPG

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_13.JPG

Section 6 - Adding the grand total

Once the rule has cycled through all the items in the assembly, we need to add the grand total to our quote.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_14.JPG

Section 7 – Wrapping up

The final step of this rule is to save the excel workbook and close the workbook as well as close the Excel application link.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_15.JPG

Section 8 – Summary

Using the supplied files as an example we can see that the rule uses the excel template we specified and adds the data for each unique item in the model browser to the Excel spreadsheet.

Exporting_data_into_Excel_from_Inventor_using_iLogic_-_16.JPG

The workbook is then stored as a new excel document in the same folder as the assembly file.

Using the information in the blog article you should be able to use the code I have supplied as a foundation for your own purposes. To add additional data, you just need to create the variables for the data in section 4 and add the data entry rows to the For Each loop in section 5.

Hopefully you find this useful.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.