Autodesk Inventor API – Part 1

By Allen Gager

Recently a question was posted on asking how to create Materials in the Style Editor from data in an Excel spreadsheet. I thought this would be a perfect opportunity to take a look at the Autodesk Inventor Application Programming Interface or Inventor API.

The goal of this series of articles is not to teach you how to program. The goal is to introduce you to the idea of what is possible and how to find the proper resources and apply them to the task you want to accomplish. Now before we get too far along, I would like to introduce you to the first place you need to bookmark. This is one of my favorite stops on the web for Inventor API information. Mod the Machine belongs to Brian Ekins, the father of the Autodesk Inventor API. Here you will find top quality articles, how to’s and other well written, helpful resources. I would like to direct your attention to his article titled Beginning API.  Please note that the series starts at the bottom of the page with Inventor API Fundamentals 001 – Getting Started and works its way toward the top. Also check out Free Online Inventor API Training Class.

Usually the first candidate for writing code is a task that needs to be done repeatedly. The Materials example is in this category. The person has hundreds of materials defined in an Excel spreadsheet and would like to avoid the time it takes to retype all that information in to the Style Editor.

The next reason you may want to write code is to enforce a standard. This could be as simple as making sure that all the text placed in iProperties is capitalized. Or maybe you need to check a large number of factors that would be impossible otherwise. Take a look at i CHECK IT as an example.

Another reason may be that a large number of calculations need to be done. Whatever the case may be, there is probably a way to do it with the API. The first step is to define what you want to do, in simplest terms.  In our example we want to; obtain data from a spreadsheet and use it to create a Material in Inventor.

I have typically found that the pieces I need to create a project already exist. I just need to figure out which ones I need to put the puzzle together. I have just presented you with two pieces of this puzzle contained in the scope statement of our definition.

  1. Obtain Data from Excel
  2. Create an Inventor Material

In the next part of this series I will show you where to find these pieces and how to start fitting them together.

Go to Part 2

  • Al

    this excel example is brain-dead easy if you use iLogic. No API experience needed.

  • Maybe. But the goal of this series is not try and invent something new. The idea is to introduce what is possible with the Inventor API and how to go about getting things done.

  • AllenG

    It should be noted that these two subjects are unrelated.

    iLogic provides conditional branching when working with Parameters.

    The subject of this series is how to load hundreds of Materials directly into the Style and Standard Editor from Excel. This example does not link an Excel document to drive Model Parameters.

  • Olgan

    Well, this is funny and fortunate, as i'm the person that asked the question and with Mr. Gager's directions i was looking for all the information i can get about API.

    Now that i look into it, and maybe getting ahead of myself, there seems like alot more opportunities like maybe just adding the needed material for the part and purging all others.

    Looking forward to second part of this series.

  • AllenG

    Hi Olgan,

    I was hoping to find you. Please send me an email.

    You have also picked up on a key element. That is that these little ideas often lead to others, and many times provide you a whole new way of looking at opportunities.

  • Olgan

    Did that at linkedin.

    First the problem was adding the 200+ materials, now its choosing the correct material from 200+ materials in a scrolldown menu. I made branch exports to thin numbers but its not ideal solution.

  • Al

    Deelip, I understand what you're saying but iLogic is more than just conditional branches (as suggested below). It's more like an API to the API.