Monday, December 7, 2009

Connecting the Pergola to User Defined Parameters

I used the Revit sample called 'User defined Parameter Read and Write' created by Prof.Wei Yan. I started by making changes in the 'UserDefinedParameterReadWrite.csproj' which is a Visual C# coding file. In the command.cs tab, a new list was selected for Pergolas and created as a new element by using the refractor(rename) method. After the 2 types of filters were setup, the Built in category was defined as Generic model as that is the family type for the Pergola. The pergola was also refactored as a new Family Instance.

Two new parameters were defined for length and breadth and formulas were assigned to them with respect to the Room area. Also 2 parameters, len and Breadth was set as 'get parameter' to retrieve them from the pergola's parameters in Revit.

The code could now be debugged. The Revit software opened to a project where i had created a single room with a Pergola in it.
I next increased the area of the room by draging one side of the wall further away. Next i selected the User defined Parameter Read Write option from the External tools drop down menu in the Add In's ribbon tool. This caused the pergola to change in size with respect to the formula used in the code.


Same procedure was followed while increasing the area of the room from an adjacent side. This also showed a difference in the Pergola's parameters with respect to changes in the room area.

Sunday, December 6, 2009

Creating a Pergola in Revit and incorporating Parametric modeling in it

I created a Pergola' (A horizontal trellis or framework, supported on posts that carries climbing plants and may form a covered walk) using the component tool in Revit. A simple example was created in order to use parametric modeling on the Pergola to see how the parameters of various inner families(individual elements of the pergola) can be associated to parameters of the Main Pergola family to enable them to change with respect to each other.

Three individual elements were created using the 'Generic Model' Family option in 3D format in the x,y and z axis directions. The same method used to create the sunshade in Project 1 was used to create the components here. The Length, Breadth and Height were added as parameters and fixed for the components. They were the following.
1. Vertical Component of the matrix
2. Horizontal component of the matrix
3. Stand(Legs) for the matrix.

Pictures are shown below in the same order as mentioned above.


These elements were then incorporated into a Generic Line based Family one by one. First teh Vertical component was added and it was arrayed. The 1st and last elements were locked into place to the top horizontal reference plane and to their respective left and right vertical reference planes. Then 2 more parameters were added for 'Number of Vertical Elements' and 'Vertical element Spacing'. A formula was added so that the Number of Vertical elements = Length of the Vertical Array/ Vertical Element Spacing. This system now worked well as when the length was changed, the other parameters changed respectively.

Next the Horizontal Element was introduced into the Pergola Family. The vertical line where the horizontal elements would be arayed was added as a parameter called 'Breadth'. In the properties of the horizontal element, its length was associated with the length of the vertical array. This ensured that when the length of the array was increased, the length of the horizontal element would increase accordingly. Similiarly in the properties of the Vertical element, its length was associated with the length of the horizontal array (ie Breadth). After the horizontal element was arrayed, the 1st and last elements were again locked to the left vertical reference plane and to the top horizontal reference plane. Again 2 new parameters were created and connected by the formula: Number of Horizontal Elements= Breadth/ Horizontal Element Spacing. Now the matrix worked both ways.

Finally the Stand for the Mtrix was introduced into the main Pergola family. Four copies were made and and locked to the 4 ends of the matrix. The heigth of the whole pergola could be controlled by changing the height of the stand element.


The final resulting 'Pergola' Family could be changed according to the user's wishes with respect to the length, breadth and height of the matrix as well as the number of Horizontal and Vertical elements as well as their spacing. The various length, breadth and height parameters of the individual elements of the pergola could be further be changed either by using the new parameters added for system height or else by opening the individual families and editing them.