Nifty Add-In Template
Creating add-ins has never been easy and because of that, there’s still a lot of room for improvement in the process. This template is an attempt to make the process of writing an add-in slightly easier. I presented a class at Autodesk University 2018 that goes into detail about creating an add-in and using this template. Following the link, you’ll find a video of the class and a paper that goes through the step-by-step details.
This Visual Studio template can be used instead of the add-in template that’s delivered as part of the Inventor developer tools. A big difference between the developer tools template and this template is the developer tools template creates an add-in that is a bare-bones add-in. It creates a running add-in but it doesn’t do anything except load. It’s up to you to figure out how to add a button into the user-interface for your command. The template does contain some commented code for creating a button but there’s additional work besides uncommenting the code that you’ll need to figure out on your own.that illustrates what you need to do to create a button but there are additional steps not shown that you’ll need to figure out on your own.
The Nifty Add-In Template creates an add-in that has a button. Of course, you’ll need to edit the code so the button shows up where you want it and has the correct icon but this gets you close to where you want to be. This template also has a function to simplify the creation of the button. Defining icons for buttons has always been difficult in the past because you needed to include the icon images as resources and then convert them at runtime into another image type that Inventor likes. To define button icons for this new function you just need to have png images in a folder within your project and then you reference that folder in the add-in code. The function takes care of all the work to use the images to create the button.
The download below is an installer that will install the template to make it available to Visual Studio. When you create a new project in Visual Studio, Choose “Visual Basic” from the tree of types of projects on the left and then “Nifty Add-In Inventor 2018” from the list on the right.
Even though it’s set up for Inventor 2018, it will work for Inventor 2018 and later. The only thing in the template that is specific to Inventor 2018 is that it is referencing the Inventor 2018 Interop Library. You can continue to use this library in later versions of the Inventor too. The main reason to update to a later version is if you want to use API functionality that is only available in the new version.
On March 21, 2019 I posted an update to this add-in (1.1.0) that updates it to use a later version of the .NET libraries.