For the final project I decided
to use the Taipei 101 Tower that I created for Project 1 to implement API
programing. In project one, before API programming was learned, the curtain
wall panels at the very top of each building family had to be selected individually
to change their material properties in order to change the panel color. These
panels were changed to make the Revit model of the tower look as close as
possible to the real tower. For the final project, with the help of API
programming, my first task was to make all of these “top” panels change color
simultaneously without having to select each one individually. My second task
in the final project was to make the main tower families which make up most of
the tower change dimensions simultaneously according to one driving parameter
defined in the project level. The reason I decided this to be my second task
was because in project one each piece that made the total tower were created as
separate mass families. These were then loaded into a total tower family and
stacked on top of each other. Finally, the total tower family was loaded into
the project file. To change the dimensions of the tower, each family had to be
selected separately and their dimensions had to be changed in the corresponding
mass family and loaded back into the total mass family, and finally reloaded in
the project level. With the use of API programming, this tedious task could be
eliminated by linking all of the building family’s dimension parameters to one
driving parameter so that all of the dimensions could be changed in the project
level at once.
Implementation of API Programming
Curtain Panels
The curtain panel system of the
tower was created in three levels: first, the individual curtain panel was
created as a curtain panel by pattern family; next, in the total building
family level all of the building surfaces were divided and the curtain panel by
pattern family was loaded into this family; lastly, the total building family
model with the curtain panel system was loaded into the project level. In order
to use API programming with the Add-In Manager to change the color of the
curtain panels at the top of each building family in the project level, the
curtain panel by pattern material parameter had to be linked to the curtain panel
material parameter in the total building family model. Once this parameter was
linked correctly, the API program could be run by selecting all of the top
curtain panels in the total building mass model, extracting all of their ID’s
and using a “for loop” in the API code to change the colors of each of these
panels randomly. However, making each of these panels a different color was not
the intention of this task for the project. It was intended that all of the
panels change the same color. Therefore, in order to do this, the part of the
code that randomized the color for each panel was taken out of the “for loop”
in the API program. This made sure that each time the program was run; the
selected panels would change to the same, random color. The figures below show
the colors of the top panels changing each time the program was run in Revit
after the code was successfully updated.
Project After Running API Program to Change
Curtain Panel Color Randomly - 1
Project After Running API Program to Change
Curtain Panel Color Randomly - 2
Project After Running API Program to Change
Curtain Panel Color Randomly - 3
Building Dimensions
After the API program to change
the top curtain panel’s color was successfully created, the task of changing
all of the building family’s dimensions simultaneously in the project level was
ready to be tackled. As was previously mentioned, the dimensions of the three
main building families that make up most of the tower were chosen to implement
this API program. The three building families can be seen in the figures below.
Tower Base
Top Tower
Spire Tower
It was decided to change the base
width and height of the base building family, the top width and height of the
eight top towers building family, and the top width and height of the spire
tower building family. These dimensions were chosen to change because these
changes would be most noticeable since the tower is so tall. All of these
dimensional changes are based on the tower base family’s base width parameter.
Therefore, when this parameter is changed, all of the other building
dimensional parameters will change accordingly with a predefined ratio. In
order to make this happen, new dimensional parameters for these building
families had to be created in the total building family model. These parameters
then had to be linked to the parameters of the individual building mass family
models. Once all of these parameters were linked correctly, the total building
mass family was uploaded to the project level. This enabled these parameters to
be accessible in the project level so that the parameters could be read,
extracted, and changed in the API Program. After the parameters are read by the
API program, they are automatically changed based on the base tower width
parameter according to predefined ratios as was explained previously. These
predefined ratios can be seen in the equations below.
Base Tower Height = Base Width * 3
Top Tower Top Width = Base Width
Top Tower Height = Base Width
Spire Tower Top Width = Base Width / 2
Spire Tower Height = Base Width / 2
These ratios can easily be
changed in the API program to alter the dimensions of the tower however one
might choose. After the API program for this task was built successfully the
program was run for multiple base width values to demonstrate the changes in
dimensions of the rest of the tower. These changes can be seen in the figures
below.
One of the issues I experienced
when trying to use API programming to change the color of the selected curtain
panels was figuring out how to link the panel material parameters in each of
the family and project levels. At first the individual curtain panel by pattern
material parameter was not linked to the panel material parameter in the total
building family model. The API program was built successfully, but when it was
run in Revit the panel colors did not change. I then linked the curtain panel
by pattern family material parameter to the panel material parameter in the
total building mass family. After running the API code the panel colors still
did not change. However, I realized that I was extracting the panel ID’s from
the project level, but the code was written to extract the panel ID’s from the
mass family level. Once I corrected
where the panel ID’s were extracted from the colors of the curtain panels
changed successfully. Another issue that I encountered was again with linking
parameters in the multiple family and project levels for the dimensions of the
tower I wanted to simultaneously change. I needed the dimension parameters in
the project level to be accessible so that the API program could extract them.
I was able to resolve this issue by creating new dimensional parameters in the
total building family model and linking them to the parameters of the
individual building mass families. Once these parameters were linked, the total
building family was reloaded into the project level and the API program written
to change the dimensions of the building based on a single parameter was run
successfully.
If more time was allotted for
this project, there are a couple of things I would have liked to complete. The
first thing would be to add exterior spot lights on the corners at the top of
each roof level. These spot lights would illuminate the façade of the building
and change colors with respect to the day of the week. This attribute is
implemented on the real tower. Using API programming I believe that I could get
the spot light’s color to change depending on the day I want to see the
rendering of the tower. I also would have liked to add more attributes to the
façade of the building such as doors and designs that the real tower portrays.
Finally, I would like to have had time to make the surrounding area look more
like an urban area by adding buildings around the tower, roads, sidewalks, and
other components that show the towers real beauty and size.
No comments:
Post a Comment