Application: MaterialProperties
Revit Platform: All
Revit Version: 2011.0
First Released For: 9.0
Programming Language: C#
Skill Level: Medium
Category: Materials
Type: ExternalCommand

Subject: Display Material Properties.
Summary: 
This sample demonstrates how to get the material physical properties of a selected beam, column or brace, how to change the material type of the selected beam and how to change the unit weight of a selected beam, column or brace.

Classes: 
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.DB.Parameter
Autodesk.Revit.DB.Material

Project Files:
MaterialProperties.cs
This file contains the main functionalities that how to get the material physical properties of a selected beam, column or brace, how to change the material type of the selected beam and how to change the unit weight of a selected beam, column or brace. It also implements the IExternalCommand interface.

Description:
Functionalities:
-	With the selected beam, column or brace the material physical properties of that object should be displayed in a dialog.
-	Present all material types and their sub types to the user and then change the material type of the selected beam to the one chosen by the user. 
-	With a selected concrete beam, column or brace change its unit weight to 145 P/ft3. Warn that this will change all instances of the elements that use this material.
-	Columns, Beams and Braces are represented as FamilyInstance objects within the Revit database.
Implementations:
-	The material element can be retrieved from a Family Instance object using the parameter named “Column Material”. This can be accessed in the manner shown in the sample code named Physical Prop. Other types of family instance will have a different name for this parameter which can be found using the Element Properties dialog.
-	All the available materials can be found by iterating through the document elements.
-	The Material Type can be retrieved by using the PHY_MATERIAL_PARAM_TYPE BuildInParameter.
-	Choices for a material type can be found by comparing all the Material’s material type with the desired material type.
-	Material changes can be applied back to the element by using the “Column Material” property or similar property for other types mentioned above.
-	Physical properties of the material can be retrieved from the Material using various parameters.
-	The unit weight can be found from the Material by using the PHY_MATERIAL_PARAM_UNIT_WEIGHT BuildInParameter.

Instructions: 
1.	Open a Revit document, and then draw some beams, structure columns or braces.
2.	Select a beam, a column or a brace; Load and run the MaterialProperties.dll.
3.	Select a material type and sub material type, click the “Apply” button, then the selected beam, column or brace’s material type will be changed.
4.	With a selected concrete beam, column or brace change its unit weight to 14.50 KN/m3 in metric project by clicking the “Change Unit Weight” button.