Monday, December 5, 2011

For the second project I tried to improve my Revit model, by implementing three new ideas using API programming.


My goal was to use CSharp to manipulate the parameters in the curtain panel, which I wasn't able to work with only using Revit. my three implementations are :
Give the inside frames in the panels random sizes.
Give the inside frames' color a random value of color in a specific range from white to grey.
Give the outside frames' color a random value of color in a specific range from white to grey.


First, we create two materials by asking the Material class , for the two materials that we are going to use further on for our curtain panels.

-------------------------------------------------------------
//Create the material

ElementId materialId = Material.Create(familyDoc, "My Material" + m);
// adding random m to avoid same names used when running the program multiple times.
material = familyDoc.get_Element(materialId) as Material;
ElementId materialId2 = Material.Create(familyDoc, "My Material_2" + m); 
// adding random m to avoid same names used when running the program multiple times.
material2 = familyDoc.get_Element(materialId2) as Material;
-------------------------------------------------------------


Then we specify the curtain panel instances, in an int array named IDS
-------------------------------------------------------------
IDS = new int[] {4105,4106,...,4426};
-------------------------------------------------------------

After that we call the SetLengthAndMaterial function using the two materials and the IDS We will explain the SetLengthAndMaterial function in a short while.
-------------------------------------------------------------
SetLengthAndMaterial(IDS, familyDoc, material, material2);
-------------------------------------------------------------

The function SetLengthAndMaterial does the followings for every ID that it is passed to:
  1. region 1 : Obtains the parameters "length", "Frame material", and "outframe material".
  2. region 2 : calculates new values for these parameters
    1. finds a random number for length from the set of {1, 3, 5, 7} feet.
    2. fins a random number in the range of [120, 255) and sets it as red, green, and blue elements of the color that will be assigned to both materials
  3. region 3 : sets the parameters to the calculated values
-------------------------------------------------------------
#region 1 Get instance parameters of the objects
Parameter panelLengthParam = panelInstance.get_Parameter("length");
Parameter panelMaterialParam = panelInstance.get_Parameter("Frame material");
Parameter panelMaterial2Param = panelInstance.get_Parameter("outframe material");
#endregion
 
#region 2 Calculates new values
int[] random_size = { 1357 };
double length = random_size[(byte)random.Next(04)];
 
byte red = (byte)random.Next(120255);
Material myMaterial = material.Duplicate("My Material " + m + "-" + n);
Material myMaterial2 = material.Duplicate("My Material_2 " + m + "-" + n);
myMaterial.Color = new Color(red, red, red);
myMaterial2.Color = new Color(red, red, red);
#endregion
 
#region 3 Set parameters of objects using new values
panelLengthParam.Set(length);
panelMaterialParam.Set(myMaterial.Id);
panelMaterial2Param.Set(myMaterial2.Id);
#endregion
-------------------------------------------------------------

When this code is executed on the project, the outcome is as follows









SnapShot#1


SnapShot#2


SnapShot#3



    Sunday, October 30, 2011

    BIM Project 1

    China Central Television Headquarters


    Project Description
    Location     East Third Ring Road, Guanghua Road, Beijing, China
    Construction started     1 June 2004
    Floor count     44
    Floor area     389,079 m2 (4,188,010 sq ft)

    Design and construction
    Owner     China Central Television

    Architect    Rem Koolhaas
    Structural engineer     Ove Arup & Partners

     

    Parametric Mass Description

    First, five similar levels are defined in different elevations with a stride of a parametric value height. Then reference lines are added to each of these levels, before hosting the surfaces on them. A reference surface is then hosted on each of the reference lines by picking the line. 
    In order to follow the slope of the original model, we had to define the walls with a parametric slope. This parameter is called distance, and is defined as the distance between each reference lines defined in step 1 with the Center reference plane. The value for this parameter is set to be dependent on the relation between each surfaces’ elevations to the first surface elevation.

    Each of the surfaces defined in the previous step was given parametric dimensions width and length. These two parameters in addition to height, define the parametric volume of the final model. This means that by increasing the values of these parameters, the model would scale nicely, while preserving the original shape.
    In order to create the first solid form, the first five surfaces in different levels were selected and the Create Form a Solid Form was used.

    The CCTV mass is composed of six different masses. All these six masses are created in the same way as was discussed in the previous two steps. Since the same parameters are used in order to create these masses, the outcome is a completely parametric model. Therefore, the model scales nicely based on the parameters given.

    Creating Parametric Facade
    CCTV building has a special facade which consist of rectangular shapes with different sizes, in a way that the density of these rectangles in more at the bottom of the facade and then it becomes less and less as we go up in the levels. To show the changes in density and size I tried different curtain panels’ forms. My first experiments weren’t that successful. It took me a while to make the appropriate pattern frame for the skin, the first frame would give the facade random lines and therefor random rectangular shapes that didn’t quite look like the original facade and I weren’t able to control the random figures.


    The first picture below shows the pattern that I finally came up with. The width of the frame in this pattern is parametric; the width is defined as an instance parameter by purpose. In this way when loading the pattern into the project, we are able to give different numbers to the frame and make it wider or thinner, so that we can show different density and sizes in the rectangles created in the facade. The next picture below shows my creative pattern with red glasses. This pattern follows the rectangular figures of the original facade but has its own figures such as red glasses and combining of only three different glasses with different colors.




    Exterior Renderings