Wednesday, April 27, 2011

Project 2 ARCH653 Revit API - Parametric Design

This project has been designed in four steps:

1) Developing BIM model of Town Hall Building of Alvar Aalto in Revit Autodesk
2) Designing parametric model of fan-shaped truss of the chamber of this building using Revit Interface
3) Developing parametric model of mass of the chamber, fan-shaped truss, and the roof of the chamber using Revit API
4) Developing 4 dimensional model of this project using Navisworks Manager

Figure 1

I have talked about the first two steps in the previous post, so I will discuss the two remaining steps in this post.

Figure 2

As we know in order access the parameters of a model which is parametrically designed in a project we have to use API programming. Therefor in this part of this project we have tried to learn how to control parameters using Revit API.

Figure 3-7 shows how the API program works in this project. After running the TownHallBuilding.dll file through Revit AdsInn, a windows application window pops up and asks about the desired roof angle for the chamber of this building.


When the user enters the angle to the project, another window pops up and shows the angle that the user has entered and double check it before making any changes to the project.


If the user confirms the angle, the API program will set the new angle to the roof of the chamber, the mass of the chamber, and two trusses that are placed under the roof of the chamber.


Figures 6 and 7 show a section of the same model with the same changes using section box.



The  API code which is developed by C# has 7 main parts:

1)            Declaring Global Variables:

I have defined the roof angle as  global variable. The only issue here was the change of units. Therefore I had to convert the value of the angle which was defined by degree in my parametric design and windows application form interface to radian. This could be done using the following formula:

Angle(Radian) =  Angle Degree * π /180

2)                Initializing and starting transaction with Revit


      3)          Getting objects from project:
Four objects have been accessed from the project. The mass of the chamber which has been used to make walls and roof of the chamber. The two fan-shaped trusses that have been located bellow the roof of the chamber. The roof of the chamber which the walls of the chamber have been joined to it.

      4)        Getting the parameters of objects:

The angle parameter of all of the above-mentioned objects are obtained form project in these lines of codes.

      5)        Getting values of the parameters


      6)        Setting the new values of the parameters of objects

Using windows application form, the user can insert desired angle for the roof of the chamber which is used to update the the values of the parameters.  The angle of the mass of the chamber, roof of the chamber, and angle of the two trusses will be update in these lines of codes.

      7)        Commit the transaction and terminating the API program

Problems and Challenges:

I have faced a problem in positioning the two trusses. It was a little strange that each time I have tried to change the location of trusses and then run the API program, the trusses have moved to an unknown location and the base plate of truss members has been separated (as shown in figure 11). In order to deal with this problem each time I had to go to all families and edit the family and upload it again to the project. I have checked the process of  developing the family members and the truss many times, but I could not solve the problem. Please go ahead and post any idea you have to solve this problem.


Figure 12

In the video 1, you can find more information about the Town Hall Building and about the process of making the 3D model, parametric model, and using API to control the variables. Also at the end of the movie the 4D model of this project is displayed.

No comments:

Post a Comment