Home Education Membership Skills Training
You are here: ARCH 653 - Project 2Edited on: 2012-04-26

ARCH 653 - Project 2:

Go to: Project 1

API for Walt Disney Concert Hall

API Coding Process

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;


        private void 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) as FaceWall//Get the element
by ID and  cast it to FaceWall 


                #region 2 Get instance parameters of the objects

                Parameter wallVolumeParam = wallInstance.get_Parameter("Volume");

                // Getting the wall type
                ElementId typeId = wallInstance.GetTypeId();
                WallType aWallType = document.get_Element(typeId) as WallType;

                // Get CompoundStructure of the wall
                CompoundStructure comStruct = aWallType.GetCompoundStructure();
                CompoundStructureLayer structLayer =
//only 1 layer in this basic wall
                Autodesk.Revit.DB.Material layerMaterial =
as Material;

                // Getting the unitweight of the materials used in the wall
                ReadMaterialProps(document, layerMaterial);


                #region 3 Calculate new values

                double wallVolumeValue = wallVolumeParam.AsDouble();
                string[] pieces = unitweight.Split(' ');
                double wallWeightValue = double.Parse(pieces[0]);


                #region 4 Set parameters of objects using new values

                totalWeight += wallVolumeValue * wallWeightValue;

            //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.

        private void 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) as FamilyInstance;


                #region 2. Calculate new values

                 *  min (wood=49.00 lb/ft³): 1,600,000 lb,
                 *  mid (Stone=100 lb/ft³): 3,300,000lb,
                 *  mid (concrete=150.28 lb/ft³): 5,000,000lb,
                 *  max (steel=490.00 lb/ft³): 16,000,000lb 

                if (totalWeight < 2000000)
                    newTypeC = w21x44_C;
                else if (totalWeight < 4000000)
                    newTypeC = w27x84_C;
                else if (totalWeight < 6000000)
                    newTypeC = w36x135_C;
                    newTypeC = w44x230_C;


                #region 3. Set parameters of objects using new values





API in Action (Screen Shots)


Figure 2- 2" Concrete Walls


Figure 3- 5" Steel Walls


Figure 4- 5" Stone Walls


Figure 5- 7" Stone Walls


Descriptive Video


SAVAFA © 2003-2020, All Rights Reserved.