Final
Project: API Programming
In the final project, I used API programming to control the pattern
of Seattle library Building facades. By using C# programming, I created curtain
panels with random opening and also different tones of blue color for
their framing.
1.
At the beginning, it is necessary
to obtain the family ID (in the project's file), define the new
transaction process and create the material for curtain panels' frame (My
Material):
2.
Second
step after obtaining the family ID (in the project's file), we need to specify the
curtain panel IDs in different part of facades:
3.
Then we define a function for
thickness and color using provided IDs, family document and material:
4.
The function
“SetThicknessColor” will be implemented in three different steps for every
single ID. Here is the logic of the orders:
a. Getting objects which are curtain panels
b. Obtaining instance parameters of panels which are
"thickness" and "Frame material"
c. Calculating new values for these parameters
Finding a random thickness from (1, 3) for
façades
Finding a random number in the range of (150, 250) and giving it to
blue element of the color which create random color tone of blue. Then define
red and green color by two formulas which related with the original random blue
color. So we can get different tones of blue color on the frames.
d. Creating parameters using new values
5.
Finally, load the Curtain
Panel.dll into Revit by using add-in manager, and run CurtainPanelByPatternCommand.
The model will be modified like the following effect: