Layne env: IyL-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 support@ketiv.com and our team will be happy to help!

Take a look at some of our automation capabilities here.

 

Back to Blog

2 Replies to “Connecting Visual Studio and Autodesk Inventor for Add-ins”

Leave a Reply

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

More stories from KETIV

Blog

Inventor Professional 2019 Tips: Why Your Snapshot Views Won't Update in Your Presentation Files

Inventor Tips: How to update Your Snapshot views in your Presentation Files Problem: This is one of your first attempts at using the presentation environment inside of Inventor.  You would love nothing more than to have a view you explode to…

Read post
Blog

How To Use Custom User Coordinate Systems with Inventor Assembly

How To Use Custom User Coordinate Systems (UCS) with Inventor Assembly for Inventor Professional The origin within an Inventor assembly or part is a feature not often thought of. The origin is assigned 3 planes, 3-axis, and a point that can be…

Read post