Tuesday, April 17, 2012

Revit API Demostration Video


Higher Quality:
http://www.youtube.com/watch?v=ANjJd_MdFvs

Future Work

If I had more time in the future to work on this Revit Model, I would like to research into creating a ribbon function for my mass model parametric intent. I have different parametric options for the user to choose from in the mass model and I would like to be able to put the interface to the parametric paths within the project user interface. By doing this, I would be able to guide the user better by creating drop down menus, buttons, input prompts, etc. to creating their customized mass model.
I believe the first step to doing this is by researching the methods to creating a ribbon panel with Revit API. The first resource I found was from the Revit 2011 API Developers Guide which has a enormous list of Revit API tools and functions that can assist with Revit API. The guide has a sections on ribbon panels to where they use functions called “Pushbutton”, “PulldownButton” and “Text Box” which creates the tools needed for me to create the parametric user interface. Other sites like Spiderinnet’s Blog and Autodesk Wikihelp has many tutorials that can assist me in developing the ribbon panel.

Autodesk (2010). “Revit 2011 API Developer Guide.” <http://www.scribd.com/doc/67901685/Revit-2011-API-Developer-Guide>. (4/16/2012).

Buidling Snapshot With Color Randomization


Project Building with Randomized Curtain Panels:

Figure 28: Building with All Panels Randomized

Figure 29: Building  with API Design Intent



Monday, April 16, 2012

Revit API Issues


Revit API Error Message:
One of the major issues I encounter when running the API code on my project file was the error message shown in Figure 33. This error message was due to the fact that the API code could not gather any instance parameters to change. In my mass family, I had type parameters for the materials of the curtain panels and this did not allow the API code to change each individual curtain panel due to the definition of a type parameter. So all I needed to do was change all of the material type parameters to instance parameters and the error was fixed.

Figure 33: C# Error message
Revit API Double Random Colors:
The second major issue I had with my API code was to make the code generate two significantly different colors for the flat face panels and the corner void panels in the full model. In Figure 29, the two panels look somewhat similar but are actually different based on the RGB integers. I thought at first that it was just a coincidence and the color just happened to turn out that way, but running it a second time slashed that theory. The pattern just kept on repeating itself. It was odd because with my small test, I knew that the two loops within the API code were engaging the right sets of panels and the two randomly generated colors were different for the two panels, so the issue must lie within the random number assignment for large scale projects. So I adjusted the limits of the random function to only choose RGB between 0 and 130 for the flat faces and 130 to 255 for the corner faces. This does limit the amount of color I would be able to generate however it gives me the necessary function to reach my design intent. 

Revit API Testing


To test the API Code, I created a project file with only one of the bay level and ran the API code with the minute amount of panel it has compared to the full model. This was a great timesaver as it only takes me 5 mins to complete the program as compared to 45 mins for the full model. Once I was able to get the fully randomize code running, I continued to modify the code to randomize base on my design intent.

Single Bay Level Mass Models with Randomized Curtain Panels:

Figure 26: Bottom Bay All Panels Randomized

Figure 27: Bottom Bay with API Design Intent

Revit API Procedure


My final goal for the Revit API code was to randomize two different sections of curtain panels for my BIM model: The flat face panels on the sides of my structure, and the corner void faces of the structure. I used the “Curtain Panel” example provided within the Project 2 sample files as a basis for the code. This API code randomizes the colors of the curtain panels for two different cases, one being if the curtain panels were made within a mass family and imported into a project file and two being if the curtain panels were created within the project file itself. My curtain panels were created within the mass family so case 1 of the API code was used and everything else was removed, including any thickness adjustment code that would have been performed.
The API Workflow for this code is:


I did not want to randomize the colors of each of the panels within the model individually so the creation of the red, blue, and green color integers was removed from the loop that repeats for every panel. The assignment of numbers for the RGB colors was coded before the loop so that for every panel that the loop would engage, it would assign the same color. This was also repeated for the second loop function that is for just the corner face panels.
In order to get the pair of loops to only engage their corresponding sets of curtain panels, I modified the inputs for the boundaries of the For loop. So for loop 1 that engages the flat face curtain panels the boundaries were from 0 to the length of the IDS vector that stores the Panel ID’s minus 36. The boundaries for loop 2 were from length of the IDS vector minus 36 to the length of the IDS vector. The number 36 originates from the finite number of corner panel faces in the BIM model.  For this part of the API code, it is required that the user copy the ID’s of the curtain panels in this order: Flat Faces, Base Level Faces, and Corner faces. In the code:

1.       Loop 1:  for (int n = 0; n < IDS.Length-36; n++)
2.       Loop 2:  for(int n = IDS.Length-36; n < IDS.Length; n++)

Other small changes to the original curtain panel code were changes in the Project ID and the curtain panel ID’s and also the addition of another random variable function for the second loop. 




Figure 25: Snapshot of C# API code for Curtain Panels (loop section)

Revit API Design Intent


Once the models were complete, I wanted to use Revit API to randomize the colors of the exterior curtain panels on the flat faces of the building and the corner void faces of the building independently. I believe the building appeal is in the uniformity of the exterior truss system and how its symmetry and solid colors help a person’s eye flow from the bottom of the tower to the top. Any discrepancies in the color scheme would distort the view flow and take away from the overall appeal of the truss system and its skin. So with Revit API, I will be randomizing the colors of the two different locations of curtain panels in the Revit Model so that the skin of the building will keep its consistency within flat faces of the building and the corners will contrast more from those flat faces to show more of the geometric shape of the structure.

Thursday, March 22, 2012

Tuesday, March 20, 2012

Screenshots of Different Mass Parameters


Screen Shot 1:
·         Parametric Total Height
·         Total Height = 600 feet
·         Total East West Width = 160 feet
 
Screen Shot 2:
·         Parametric Height and Width
·         Base Level = 120 feet
·         Width = 40 feet
·         H2-H10 (Even Only) = 40 feet
·         H3-H9 (Odd Only) = 60 feet
Screen Shot 3:
·         Parametric Height and Angle
·         Base Level = 120 feet
·         H2-H10 (Even Only) = 40 feet
·         H3-H9 (Odd Only) = 60 feet
·         A2-A10 (Even Only) = 50 degrees
·         A3-A9 (Odd Only) = 65 degrees
Screen Shot 4:
·         Parametric Width and Angle
·         Base Level = 120 feet
·         Width = 40 feet
·         A2-A10 (Even Only) = 50 degrees
·         A3-A9 (Odd Only) = 65 degrees

Revit Issues/Comments


Aligning Masses:

The first issue I encountered was the continuous misalignment of my stacked masses whenever I would change the value of my parameters. I tried to align the sides/planes/lines of the levels and locking them but they would always break during the parametric change. I believe that the issue stems from the fact that for my initial layout of reference planes that I had in Figure 9, the two pinned planes were on the sides and did not cross through the center point. Because the pinned reference planes were on the side, the dimension changes would extend from those sides instead of through the center which for some unknown reason causes issues for Revit in terms of alignment. This issue was resolved by initially pinning the reference planes that cross through the center point. So then when I place the masses in the host family, all I needed to do was manually alignment the masses onto one another without the need for align locking.

Curtain Panels:

I was having an issue with the custom curtain panels on the Top/Bot Level Shape in which they would stick out from the sides at certain elevations and not be partially cut off like the properties settings were meant to do (Figure 22). There was one solution to set the curtain panel properties to “blank” and create adaptive curtain panels on the missing panels, however because of my curtain panels increase and decrease parametrically, I would not be able to know for certain which panels I would need to make adaptive. I believe that solving this issue with parametric quantities of adaptive panels is beyond the scope for this Project 1 but will be easily solved once the methods for Revit programming is learned for Project 2.


Figure 24: Curtain Panel Issue

BIM Modeling

 
For the BIM model, I chose to model in detail a generic floor of the Tower. I could not get a very good quality floor plan of its typical office floor but from what I could gather from cross section views of the Hearst Tower, the office area contains:

1.       A sets of 8 (4 facing 4) Elevators

2.       Desks surrounding the inner core of the floor

3.       Private offices in the small rectangular areas along the perimeter of the floor

4.       Meeting rooms in the larger rectangular areas adjacent to the private offices and also on the corners of the floors

5.       Large work room on one of the corners

6.       Storage, restrooms, or smaller workrooms in the rooms of the inner core of the floor


Figure 22: Office Floorplan

Facade Modeling



Figure 14: Facade of Hearst Tower

Figure 14 shows the Façade of the Hearst Tower which happens to also be the Diagrid system that the structure uses. To replicate the skin onto my model, I had to:  

1.       Create the glass curtain panels with horizontal mullions onto the Top and Bottom Shape masses

2.       Create a form that follows the same path as the Diagrid system of the Hearst Tower.

To achieve the first goal, I made a custom curtain panel from the stock rectangular surface pattern. The custom curtain panel is shown in Figure 15, in which there is only one solid rectangular form made from two rectangular reference lines at the corner reference points. It is only done on one side in order to prevent overlapping. For the Top Level and Bottom Level Shapes, the number of rows and columns of divided surfaces are set as a function of the width and height, there is a row of panels at every 10 feet and a column of panels at every 9 feet 6 inches for the W1 direction and 8 feet 4 inches at the W2 direction.


Figure 15: Custom Curtain Panel

For goal number 2, I needed to make a path of reference lines that wraps around the Top Level or Bottom Level Shape (Figure 16 and Figure 17). Once I have achieved this, I can create a shape for the Diagrid system at an end of the path and create a lofted solid form for the Top/Bot Level Shape by simply selecting the end shape and tab selecting every diagonal reference line around the Top/Bot Level Shape. I made the depth of the Diagonals in the Diagrid system a 1/16th of the height of the Level Shape. The final product can be seen in Figure 20 and Figure 21.

Figure 16: Diagrid Layout
Figure 17: Reference Line Wrap

For the Base Level Façade (Figure 19), I modeled the mega-diagonals that the Hearst Tower has at its base level for additional lateral support. They are simply a solid form that is parametric with the height and width of the base level. There are 6 total mega-diagonals and I approximated their depth to be about 90% of the column depth. The façade of the space between the Columns consists of three panels where the middle panel has a vertical mullion that is significantly larger than the ones on the levels but not as thick as the columns. These panels will not increase in number as the base level gets bigger.

Figure 18: façade Conceptual Mass
Figure 19: façade Base Level
Figure 20: façade Top Level Shape
Figure 21: façade Bottom Level Shape

Modeling the Conceptual Mass


The parametric mass model for the Hearst Tower is comprised of 10 conceptual masses stacked and aligned to one another. Of the 10 masses, there are three different shapes for the conceptual mass shown in Figure 5-Figure 8. Each shape has its own unique feature, for example the top level shape has corner void extrusions that slope inward from the top face.

 
Figure 5: Conceptual Mass
Figure 6: Conceptual Mass
Figure 7: Top Level Shape
Figure 8: Bottom Level Shape

Top Level Shape:

To create the top level shape, I initially started with a rectangular block that is defined by 6 reference planes, and two reference levels that have two parametrically controlled dimensions, Width W1 and Width W2, which correspond to the larger width and the smaller width of the Hearst Tower respectively and the Height Hi of the level. The two reference planes that cross the center point of the grid are pinned to help enforce the alignment of all the masses (Figure 9).


Figure 9: Base Reference Planes

Once the initial mass is created, the void forms for the corner cuts need to be made in order to replicate the corner geometry that the Hearst Tower has due to the Diagrid system. To do this, I drew a trapezoid made up of reference lines on each face of the rectangular block and to connect each the corners of the shorter length of the trapezoid, I used a single 3D reference line (Figure 10). The dimensions of the trapezoid were controlled by:

1.       Height Hi: Controls the height of each of the shape and will be linked to the height determination from the user defined parameters and the host mass.

2.       Bot W1/Bot W2: Controls the bottom or shorter base length of the trapezoid. This parameter is a function of the main widths W1 and W2 of the structure.

3.       The angles of the trapezoid were kept symmetric by the aligned base lengths to the reference levels and also the “EQ’ed” dimensions from a center point intersecting reference plane to the ends of the Bot W1/Bot W2 reference lines.

Figure 10: Trapezoidial Reference Lines
Figure 11: Void Forms

Once all of the trapezoids and 3D connection lines have been drawn, I selected each corner triangle reference line to create the aforementioned void form (Figure 11). In the completed mass model, there are a total of 4 Top level shapes which are aligned with the Base level and Bottom Level shape masses. As previously mentioned, in the host family the Width W1 and Height Hi parameters of the Top level shape are linked to calculated widths and heights from the user defined parameters and their corresponding trigonometric equations.

Bottom Level Shape:

The method of creating Bottom Level Shape mass is the same as the Top Level Shape mass. The only differences between the two shapes are the angles at which the corner void forms are shaped. Also instead of the Bot W1/Bot W2 parameters, the Bottom Level mass has Top W1/Top W1 which is still a linked function of the Width W1 and W2 of the host family. There are 5 total Bottom Level Shape masses.

Base Level:

The 20 mega-columns supporting the Diagrid system of the Hearst Tower are modeled in this mass. Instead of making a large rectangular mass and creating a façade that looked like the mega-columns, I went ahead and created an extrusion for each of the 20 mega-columns as well as a thin walled mass connecting between the columns to use as a dividing surface for the façade (Figure 12). To create the masses, I drew rectangular reference lines on the sides (front, back, left, and right) of the model and set the dimensions of the rectangles to its corresponding widths and heights. Once they are drawn, I selected the rectangles and created a solid form, making an extrusion into the plane in which the rectangle was drawn on. I assumed that the columns were square and that the depth of the column was equal to a quarter of the column spacing.


Figure 12: Column at Base Level

Parametric Paths:

In the conceptual mass model of the Hearst Tower, I have set up the “parametric paths” that were mention previously within the properties of the family type. Whenever the window for the family properties is open, and under Constraints there are the options:

1.       Parametric Width: When you choose this option you will change the column spacing of the model and in turn change the widths of the model.

2.       Parametric Total Height: Choose this option to set the total height and the long width of the model. It will calculate Calc_Weq and Calc_Heq

3.       Parametric Height: This option will let you set the height of each level including the base level.

4.       Parametric Angle: Choosing this option will set the angles of the corners or isosceles triangles of the masses.

In the properties window, to select an option you change the value of the option to 1 otherwise to deselect it, you set it to 0.

In order to define all of the parameters of the mass model you would need to select two options, unless you select the Parametric total height in that case there are two dimensions (width and height) already set in that one option. If the user doesn’t select two different options or the Total option than under “Definition Check” a value of ERROR will be outputted (Figure 13). Below the Constraints parameters the Text parameters tells the user which Dimension parameter he/she needs to define depending on the options they have selected.


Figure 13: User Defined Parametric Options With Error

So depending on what option the user selects, the user will need to define the corresponding values under the dimension parameter category. In most cases, it is pretty straight forward which dimension you will need to define based on the option you choose. However the Base Level dimension parameter will need to be defined if the user doesn’t select the Parametric Total Height option.

When the user is done selecting the parameter options and inputting the corresponding dimensional values for the options, I’ve set up an if statement for the calculated values of heights and widths that are necessary for the mass to form.  I used an “OR” statement in each of the “IF” statements because I needed more than one condition to apply for the “IF” statement to be true. In short, Revit determines the parametric option combination that the user defines and then from whatever combination number it is, the calculated heights and widths (Calc_Hi or Calc_Wi) are determined. The progression of “IF” statements is as follows:

1.       If User selects options… Parameter Width, etc... Combination = ???

a.       Combination = 1 if Height and Width are selected

b.       Combination = 2 if Height and Angle are selected

c.       Combination = 3 if Width and Angle are selected

d.       Combination = 4 if Total is selected

2.       If Combination (Or PC) = 1, 2, 3 or 4

a.       Calc_Hi =  Hi (user-defined) or ½*Width*tan(Ai) or Calc_Heq

b.       Calc_Wi = Width or 2*H2/tan(A2) or Calc_Weq

c.       ***The exact equation can be found in XXX