My First Inventor Plug-in Overview
Are you an Autodesk Inventor power user with an interest in becoming even more productive? Would you like to automate or extend the capabilities of Inventor, but are new to computer programming? If so, then this guide is designed for you.
“My First Plug-in” is a self-paced tutorial guide for a smooth introduction into the programming world. This is a “one-stop shop” learning path for users who know Autodesk products but are absolutely new to programming and are thinking about taking the plunge. In this guide, you will be working with the Autodesk Inventor COM API and the Visual Basic programming language, however if you prefer the programming language C# we have provided the code samples in this language as well.
Product: Autodesk Inventor
Programming Language: VB.NET (and C# - does not include written explanations for C# code samples)
Application Programming Interface (API): Inventor COM API
There are many resources available on the web for you to learn about the Autodesk Inventor API (Application Programming Interface), however, these resources tend to be designed for people who already know programming. This guide is different: it assumes no previous programming knowledge and yet helps you build your first plug-in quickly, without swamping you with details. You’ll have a working plug-in within an hour of starting this material, irrespective of your current level of programming expertise.
The guide will start by reviewing the benefits of customizing Autodesk software before progressing onto lessons covering the use of the Autodesk Inventor API. The lessons will start by modifying a Visual Basic project that connects to an Inventor session before covering more detailed explanations of the underlying principles and further developing the plug-ins functionality.
The Benefits of Customizing Autodesk Inventor
In today’s world, you’re encouraged to become more and more efficient. This is a key benefit of customization: tailoring the software you use on a daily basis to streamline workflows increases your efficiency. Autodesk provides powerful APIs and Software Development Kits (SDKs) that allow you to gain greater value from your investment in Autodesk software by tailoring it specifically to the needs of your business.
Autodesk Inventor provides a rich API that can be used to customize the product’s existing features or by adding entirely new ones. You can automate repetitive, time-consuming tasks and extend core features without leaving the Autodesk Inventor environment. The API can be used to create custom tools and features that plug directly into Autodesk Inventor, extending its functionality.
The Autodesk Inventor API is based on a COM technology which means you can use a variety of programming languages (VB.NET, C++, C# and Python) to develop a plug-in. While each language has its own relative benefits, VB.NET is the natural choice for this guide: it is easy-to-learn, easy-to-use and a good general-purpose programming language. As you become comfortable with the content of this guide – and more proficient with VB.NET - you’ll be able to move on to solving more and more complex problems with the language.
Programming can be very rewarding. We hope you feel that way too after completing these lessons. Have fun!
Summary of the Plug-in
“My First Plug-in” provides control over the visibility of groups of components in an Inventor assembly: the plug-in is designed to ask the user to select a set of components before tagging them, allowing the groups to be hidden and shown at the click of a button.
Inventor allows you to set the component visibility via its user interface, but it’s a laborious process: you need to browse to each component in order to set its visibility individually. By using the API you can automate the process, allowing groups of components to be hidden or shown. This type of task is ideally suited for automation via the Inventor API, and this guide will take you through the process of doing just that.
Video: The Completed Plug-in
This video demonstrates the final plug-in you will be creating in Lesson 6 of this “My First Plug-in” guide.
Software to Install Prior to Starting
- Autodesk® Inventor®
This guide is applicable for all Autodesk Inventor versions. Please replace the text '20xx' to the product version that you are using throughout the guide.
- Microsoft® Visual Basic® Express
This material focuses on the steps needed to use Microsoft Visual Basic 2010 Express. Using other versions of Visual Studio that support Visual Basic is also possible.
Video: How to Install Visual Basic 2010 Express
Summary of the Lessons
- Lesson 1: The Basic Plug-in
In this lesson, you will begin by writing part of a VB.NET application that uses the Autodesk Inventor API to hide selected components.
- Lesson 2: Programming Overview
In this lesson, you will look more closely at what happens when you execute the plug-in code, exploring the Visual Basic Express environment.
- Lesson 3: A First Look at Code
In this lesson, you will take a closer look at the Inventor API by continuing work on the project you created in Lesson 2, extending it to use the Inventor API to connect to or start a session of Inventor while taking a close look at how the code actually works.
- Lesson 4: UI’s and Coding Logic
In this lesson, you will add a button to the form and have it hide selected components; using the code you entered in Lesson 1. You will now spend some time to understand how the code functions.
- Lesson 5: Adding Attributes
In this lesson, instead of directly hiding the selected components, you will now modify the code to “tag” your components so they may be hidden or displayed. Attaching attributes provided by the Inventor API will allow us to identify and perform different operations on your tagged components.
- Lesson 6: My Final Plug-in
In this lesson, instead of toggling the display of the components, you will add an additional button to provide the user with the direct capability to either show or hide them. You will also add two more buttons, one to remove your attribute tag from the selected components and another to remove the attribute from all components. You will make your code easier to extend and maintain by creating procedures that are called when buttons are clicked.
- Lesson 7: Learning More
In this lesson, we provide you with additional information to increase your productivity when creating Autodesk Inventor plug-ins. You will look at information on API-related help, documentation, samples and – most importantly – where to go next to continue your learning around the Autodesk Inventor API.