The aim of this section of the project is to calculate the total weight of the curved walls around the main building based on the unit weight of the material and thickness of the walls and then change the size of the interior steel structures (columns and beams) based on the calculated wall weight. This idea is from the real project. The Walt Disney Concert Hall was initially designed with stone exterior walls but further in the project this design changed to steel walls. This change in the walls material is used in here to show the impact of material unit weight to the building steel structure. To accomplish this objective the following steps has been taken.
1. Initially the global and local parameters were defined;
2. Walls, Columns and Beams IDs were set in proper arrays;
3. Two functions were defined for calculating the walls volume and weight:
a. calWallsVolume();
b. calWallsWeight();
4. The above functions set the “totalVolume” and “totalWeight” parameters which are global parameters;
5. Then columns and beams types are updated using two other functions:
a. setColumnType();
b. setBeamType();
6. By using “TaskDialog.Show()” function the calculation results are shown right before implementing the changes;
7. Finally the API will get committed to apply changes to the model.
Figure 1- Main API Structure
Describing calWallsWeight();
A loop goes through all the walls which are defined in an array parameter. For each wall the volume would be retrieved from the instance parameter “volume”. Then the type of the wall is defined and based on the material layer of the wall, the unit weight will be accessed and set to a parameter. By multiplying the volume and unit weight of the material the weight of the wall is calculated. Weights of all the walls are cumulated in a global parameter, totalWeight;
privatevoid calWallsWeight(int[] IDS, Document document) { ElementId id; //Loop through all curved walls instances, and calculate their weight for (int n = 0; n < IDS.Length; n++) { #region 1 Get objects
// use id to get the curved walls instance id = new ElementId(IDS[n]); //ID value of the curved wall instance,
obtained from the Revit model FaceWall wallInstance; wallInstance = document.get_Element(id) asFaceWall; //Get the element by ID and cast it to FaceWall
#region 4 Set parameters of objects using new values
totalWeight += wallVolumeValue * wallWeightValue;
#endregion } //return totalVolume; }
Describing setColumnType();
First all the needed column types are defined using their ID. Then a loop trough all the column available in the array of columns will get the family instance of each column. After that and based on the total weight of the walls new type for columns would be determined using four categorizes of the total weights. Finally the new type will be set to the column and loop goes until all columns are updated. Similar structure is used for the beams.
privatevoid setColumnType(int[] IDS, Document document) { ElementId id; ElementId w10x33_C = new ElementId(101944); ElementId w10x49_C = new ElementId(101942); ElementId w21x44_C = new ElementId(219202); ElementId w24x55_C = new ElementId(219200); ElementId w27x84_C = new ElementId(219198); ElementId w30x90_C = new ElementId(219196); ElementId w33x118_C = new ElementId(219194); ElementId w36x135_C = new ElementId(219192); ElementId w40x149_C = new ElementId(219190); ElementId w44x230_C = new ElementId(219188);
//Loop through all columns instances, and change each one's Type for (int n = 0; n < IDS.Length; n++) { #region 1. Get objects
id = new ElementId(IDS[n]); //ID value of the column instance,
obtained from the Revit model FamilyInstance col = document.get_Element(id) asFamilyInstance;