Thursday, November 15, 2012

Revit API Programming Templates 5

There are 2 more templates that I am going to talk about in this post. These templates are created based on your questions to help you to finish your projects.

1- The first template is about using Windows Form Application and retrieving data from Revit, then changing the data, and apply it to Revit project. When you run this template the form fills up with the current number of parameters inside Revit. This template has two separate classes. the first one uses a simple form to get  a door width and then shows it in the form. The user can see the current value and then he can change it inside the form. The second class does the same thin, but it shows you how to access energy settings of a Revit Project.

2- The second template shows how you can make an add-in ribbon panel inside Revit. In order to get familiar with the process you can visit Autodesk Revit API Wiki and learn the process. I have made some changes to this process to make it more manageable.
In order to run the template, you have to add addin file to your computers addin folder. Please read the Autodesk wiki mentioned above for details. Then when you open Revit, it asks you to select a dll file. Go to "add in dll file" inside the template provided, and select the dll file. Then it will asks you to select a logo for your panel. If you have a logo please find it and select it. Otherwise, it will use an online logo of Revit for your panel. Then you will have your customized revit button in the project.

Please let me know if you have any questions.

Tuesday, November 13, 2012

Revit API Programming Templates 4

In this post I am adding a new template to our archive. This template is Windows Form Application templates which enables you to get user input for your API program. Sometimes in your Revit application you need to get user's input to achieve your goal. Designing windows from application is the most common approach to get the user input.

In order to add a windows form to your project, in Visual Studio right click on the your project in Solution Explorer. Then Add, Windows Form. Now you will have a class of Windows Form added to your project. You can right click on the Form1 and access to the background cod of the Form1 Design. You need to add some lines of code to your project which you can ind in the uploaded template.

Thursday, November 1, 2012

Revit API Programming Templates 3

This provides a Revit API programming template for using external data. This template (ExternalDataFromExcel) provides a class as an example on creating an excel file from scratch and fill it with the information from your Revit project and change the format and style of cells inside the worksheet.

The Second class in this template, provides you an example of reading an existing excel file and use the values of each cell in Revit project.

The third class, is the same as the second class. In this class, we use the data from excel file and change the type parameters of a window selected by user in Revit project. In this class the user is asked to select a window and then the code gets the type parameters of that window. Then the code reads data from excel file and changes the window type parameters respectively. This class would be a good start for those who want to update their model in Revit using external data from excel.