Layne env: ypt-ketiv

by Philip Cox, November 9, 2020

Connecting Visual Studio and Autodesk Inventor for Add-ins

Back to Blog

Using iLogic within an Inventor part can unlock many opportunities for automation. However, at some point the requirements of your desired automation outcome surpass what iLogic was designed to do.  This is when you need to leverage a full IDE like Visual Studio.  A great way to do that is by creating an Add-in.

Getting Started

To start connecting Visual Studio to Inventor through an Add-in, the first step is to setup a template.  Autodesk provides one as part of its developer tools. To access this, double click on the developertools.msi found in the SDK folder shown below.

 

Next, you need to check that the AddInTemplate zip file is in the correct folder based on what version of Visual Studio you are using.  Currently the template zip file is placed in the Visual Studio 2017 project templates folder, if you are not using 2017 then you will need to switch it to the appropriate folder as shown for 2020 in the example below.

 

Now that you have done that, you should be able to access that template in your Visual Studio Editor.  Create a new project and select the Autodesk Inventor AddIn template.

Now that the project is created using the template, several project settings need to be set up.  Right click on the project file and open the project properties.

Making Changes

Here there are several things we will need to change. First, on the application tab, make sure the Target framework matches what is listed in Autodesk’s system requirements for Inventor as shown below.

 

Next, create a new folder at C:\ProgramData\Autodesk\Inventor Addins\ named after your application then select it as your “build output path:” as shown below.

 

Also on the compile tab, click the Build Events button and clear out all of the build events by deleting any text you see in the pre-build event and post build event text boxes.

 

On the Debug tab, switch the Start project radio button to “Start external program”. Then click the browse button and select the inventor.exe file in path shown below (changed based on the version of Inventor).

 

Now that we have set those properties, there are two settings to check on the Inventor.addin file.  Select the Inventor.addin and change its “Copy to Output Directory” property to “Copy if newer” as shown below.

 

Next, double check that the “supported software version greater than” value is correct within the file’s text. Change the value shown below if needed.

 

<SupportedSoftwareVersionGreaterThan>23..</SupportedSoftwareVersionGreaterThan>

Now all the properties have been set.  What remains to be done is to modify the template to make your add-in appear on a ribbon in inventor. Select the “StandardAddInServer.vb” and uncomment the following lines shown below.

 

Next, click the start button in visual studio which will launch Inventor.

 

To unblock the app launch the add-in Manager and uncheck the “Block” check box, and check the Load Automatically and Loaded/Unloaded boxes.

 

This will make a button appear in your tools ribbon that when click will launch a message box saying “Button was clicked.” (Note: the name of the button and ribbons in the example below have been changed).

 

And there it is.  Congrats you have launched your first add-in!

 

Need assistance? Give us a call at 1-866-465-3848 or shoot us an email at lifeline@ketiv.com and our team will be happy to help!

Take a look at some of our automation capabilities here.

 

Back to Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

More stories from KETIV

Blog

How to program in Inventor iLogic – VB.NET Operators and Expressions

When programming, it’s tough to get the results you want without knowing all the tools you have in your toolkit. Since Inventor iLogic is built on Microsoft’s VB.NET language, we can use their extensive documentation to get a better…

Read post
Blog

3 Ways to Standardize Your Tube and Pipe Environment

Having trouble getting started with Inventor’s Tube and Pipe? Or are you looking to implement a standard process and procedure in your companies’ environment. Defining a standardization between Content Center, Tube and Pipe Styles and File…

Read post