After having an introduction on programming with C#, from today we officially start working on Revit API programming. Meanwhile, I will try to add more posts on programming with C# and provide you with some useful links.
In order to start Revit API programming you need to have the following software installed:
- Autodesk Revit 2013 - You can download the student version of this software here.
- Microsoft Visual Studio 2010 - How to Download Microsoft Visual Studio Free for Students Post illustrates the steps to download visual studio 2010 free for students. If you are not a student, you can download C# express instead here.
- Revit 2013 SDK - You can download Revit 2013 SDK from Autodesk Developer Network (ADN) . You can find more detail on how to install Revit 2013 SDK later in this post.
The best place to start learning on API programming is ADN website. After opening this page, first watch the video under My First Plug-in Title. This video gives you some ideas about how a plug-in works and what you can do with a very simple revit plug-in.
Then scroll down to the bottom of the page and download the Revit 2013 SDK from Tools. Then run the file you have downloaded and install the Revit 2013 SDK. This software adds a new tab to your Revit interface named Add-Inns. You will use this tab to run the plug-ins that you create later. Also,It will creates a folder with the same name in you Local Disk (C:). Go to this folder and browse all the files and folders in it.You can see what folders and files should be in your SDK folder in the following image.
Between these files and folders you will use the following more than others:
- Add-In Manager - Go to this folder and run the executive file named Add-In Manager for Autodesk Revit 2013. this program gives you an interface to manage your plug-ins. It will help you a lot and make your work much easier. We will come back to this topic later.
- Samples - This folder contains a huge amount of API samples that you can go through and learn more about API programming. I would recommend you to find a sample close to what you want to do and use it as base for your projects. In the samples folder, there are some .html files. These files help you to get more information on samples such as their difficulty.
There are some changes in the Running the Plug-in too. When you go to Revit, in the Add-Ins tab in the external tools you will have Add-In managers tool as shown in the following.
Choose the Add-In Manager (Manual Mode). A new window will pop up. Select the load botton on this window and locate your dll file.
When you load the .dll file, you will see your class and .dll file in the Loaded Commands tab of this window.
Select the class name and hit Run button. Then follow step 4 and 5 of the Running the Plug-In of the ADN website.
Then read Lesson 2 and Lesson 3 to learn more about API programming.