2013年5月1日星期三

Arch 653 Final Project



In the project two, I added some parameters to change the color of the building, include panel and light.

The first command is change the color of curtain system. In my case, each panel are the same type, so I only need to change the parameter of the type instead of the instance.
First, I get the id of one panel, create a material for it, which is random in different colors

Then I get the type parameter through 3 steps:
ElementId typeId = panelInstance.GetTypeId();
ElementType panelType = document.GetElement(typeId) as ElementType; //Get type
Parameter panelMaterialParam = panelType.get_Parameter("Material");

Third, calculate new values for the color of material, the value of color is base on RGB fomula.  
#region 3 Calculate new values
              
                byte red = (byte)random.Next(0, 255);
                byte green = (byte)random.Next(0, 255);
                byte blue = (byte)random.Next(0, 255);
                Material myMaterial = material.Duplicate("My Material " + m + "-" + n);
                myMaterial.Color = new Color(red, green, blue);
                myMaterial.Transparency = 50;
                #endregion


The second part is changing the light of building at night.
First, I put four types of light in the building, one type is interior light and other three are exterior lights.
                
Then I get id from those three exterior lights separately, set a parameter of the light color, and change the color random for three lights.
Because each light has one random color, so I have to repeat the process three times.
Then get the type parameter from objects.

Caluculate the new parameter of color
The value of color is base on MSaccesscode which is different from RGB, So I have to convert RGB value to MSaccesscode.

Then set the parameter of color to each exterior lights.


Also, I set the light color and luminous intensity of interior light with white color and 100.

Run the application and rendering.