1) I increased the number of PVs (Num parameter) in relation with the length of the roof (RoofWidth).
2) I changed the height (Height parameter) of the PVs.
3) I changed the angle (PVAngle parameter) of the PVs. (I realized this through two different ways that will be explained later).
1. THE PROJECT
Figs. 1.1 and 1.1a show the roof view of the office building. Fig. 1.1b shows the Properties window with the used parameters in the Dimensions Area.
Figs.1.1 and 1.1a Roof view of the office building
Fig. 1.1b Properties window with the used parameter in the Dimensions area |
2. MICROSOFT VISUAL C# EXPRESS EDITION: THE TOOL USED TO CODE INTO REVIT
I used the Microsoft Visual C# Express Edition for this project. I wrote a code in order to assign the variables. Fig. 2.1 shows the .code to assign the variables. I had to place the ID number for the roof (186775) and the two lines of PVs (371291 and 378770). These variables will be used by the parameters.
Fig. 2.1 C# Code with Microsoft Visual C# Express Edition |
Then, I wrote a code to set and get the parameter for the PVs and the length of the roof and change the number of the PVs. Figs. 3.1 and 3.2 show the code to set and get the parameters. The parameters in the GET PARAMETER section such as "Area" and "RoofWidth" come from the Revit Project file (Fig.3). This will be connected to the code once it is uploaded and make the changes.
Fig. 3.1 Get Parameter code for the Roof, PVs, Height and PVAngle |
The SET PARAMETER section has a equation to get the roofbase of the roof in relation with the Area of and the height the roof (Fig. 3.2).
Fig. 3.2 Set Parameter code for the Roof, PVs, Height and PVAngle |
Also, the connection between the length of the roof and the number of PVs is showed in this place through the next lines:
-The equation to calculate the roofbase is roofbase = (area.AsDouble() / 30.59375) - 8;
-Then, the number of PVs will change in relation to the size of the base of the roof through the next line:
pvroofwidth.Set(roofbase);
4. EDIT THE HEIGHT OF THE PVs
A part of the code will be used for a pop up dialog window to input the height of the PVs. This area of the Command.cs is connected with the Form1.cs that has the information that the user will use to input the height of the PVs.
-The equation to calculate the roofbase is roofbase = (area.AsDouble() / 30.59375) - 8;
-Then, the number of PVs will change in relation to the size of the base of the roof through the next line:
pvroofwidth.Set(roofbase);
4. EDIT THE HEIGHT OF THE PVs
A part of the code will be used for a pop up dialog window to input the height of the PVs. This area of the Command.cs is connected with the Form1.cs that has the information that the user will use to input the height of the PVs.
This part of the code (Fig. 4.2) will link the code for the height in the main code (Command.cs) with the physical pop window in the Form1.cs code file (Figs. 4.2a and 4.2b).
Fig. 4.2 Pop window code inside Command.cs file
|
Parameter height2 = pv2.get_Parameter("Height");
Finally, I want the user to input the height. The height will be change automatically in the Revit file.
5. EDIT THE ANGLE OF THE PVs
I can edit the angle of the PVs through two different steps:
1) User can input the angle of the PV through a pop window (Form2.cs)
2) The angle of the PV will be extracted from a *.CSV file
1) The first step will need the next elements:
-Write down the default newpvangle and transform the angle from radians to degrees through the next formulae (Fig.5.1):
Fig. 5.1 The default new height is assigned in this part of the code |
-The Form2 code needs to be active (Fig. 5.2). This will allow the pop window into the Revit file and the user will be able to input the new PV angle:
Fig. 5.2 Form2 code for the pop window activated to input the PV angle |
Fig. 5.2a Current pop window from the Form2.cs file inside the Command.cs file |
-Fig. 5.2b shows the code used inside the Form2.cs file for the pop window. There is another equation to change the radians to degrees and is connected to the OK button:
UserDefinedParameterReadWrite.CS.Command.newpvangle = Double.Parse(textBox1.Text)/180.0*Math.PI; public static double newpvangle = 90.0/180*Math.PI;
UserDefinedParameterReadWrite.CS.Command.newpvangle = Double.Parse(textBox1.Text)/180.0*Math.PI; public static double newpvangle = 90.0/180*Math.PI;
-The next code needs to be commented (Fig. 5.3). This will avoid the Revit file to overwrite the input from the user.
-The next code needs to be commented (Fig. 5.3). This will avoid the Revit file to overwrite the input from the user.
2) The second step will need the next elements:
-Write down the default newpvangle and transform the angle from radians to degrees through the next formulae (Fig.5.4):
Fig. 5.4 The default new height is assigned in this part of the code |
Fig. 5.5 Form2 code commented |
Fig. 5.6 Functions of reading data from *.CSV file |
6. RESULTS SEEN IN THE REVIT FILE
Back to the Revit drawing, the upper and lower lines of PVs have to be locked on the roof in the site view (Fig.6). I had to draw a reference line, align the first PVs of each line and locked them. Later, I gave a dimension from the edge of the roof to these first PVs and locked them.
Back to the Revit drawing, the upper and lower lines of PVs have to be locked on the roof in the site view (Fig.6). I had to draw a reference line, align the first PVs of each line and locked them. Later, I gave a dimension from the edge of the roof to these first PVs and locked them.
Fig.6 Roof view showing how to lock the PVs to the reference line. Also, the lower (and the upper)dimension is between the edge of the roof and the reference line that will lock the PVs to the edge. |
Then, once the boundary of the roof in the Revit Project is edited and increased, the PVs will follow the edge of the roof (Fig. 6a, 6b and 6c).
Fig. 6a Edit boundary command apply to the roof |
Figs. 6b and 6c PVs will follow the edge of the roof
Finally, the Command.cs will be uploaded and the number of PVs will increase (Fig. 6d and 6e). Also, the roof can be edited again and increased to the other side and the number of PVs will change again (Fig. 8 and 8a)
Figs. 6d and 6e The Command.cs file is uploaded to the Revit file and the number of PVs will change.
Figs. 6f and 6g The roof is edited again, the Command.cs is uploaded to the Revit file and the number of PVs will change again.
Figs. 6h and 6i The height (3 ft.) and the angle (120 degrees) are edited, respectively throught the Form1 and Form2 pop windows (West view)
Fig. 6j Properties window with the edited PVAngle and Height parameters |
Fig. 6k *.CSV file (Col1 has Day / Month / Hour) and Col2 has the angle) |
Fig. 6l Angle is edited (167 degrees) using the *.CSV file |