C# Class Revit.SDK.Samples.MaterialProperties.CS.MaterialProperties

Inheritance: Autodesk.Revit.UI.IExternalCommand
Mostra file Open project: AMEE/revit Class Usage Examples

Public Methods

Method Description
ChangeUnitWeight ( ) : bool

change unit weight of selected component to 14.50 kN/m3

Execute ( ExternalCommandData commandData, string &message, Autodesk elements ) : Autodesk.Revit.UI.Result

Implement this method as an external command for Revit.

GetParameterTable ( object o, MaterialType substanceKind ) : DataTable

get a datatable contains parameters' information of certain element

SetMaterial ( ) : void

set the material of selected component

UpdateMaterial ( object obj ) : void

Update cache material

Private Methods

Method Description
AddDataRow ( string parameterName, string parameterValue, DataTable parameterTable ) : void

add one row to datatable of parameter

CreateTable ( ) : DataTable

Create an empty table with parameter's name column and value column

GetAllMaterial ( ) : void

get all materials exist in current document

GetCurrentMaterial ( ) : Autodesk.Revit.DB.Autodesk.Revit.DB.Material

get current material of selected component

GetSelectedComponent ( ) : void

get selected beam, column or brace

Init ( ) : bool

firstly, check whether only one beam, column or brace is selected then initialize some member variables

Method Details

ChangeUnitWeight() public method

change unit weight of selected component to 14.50 kN/m3
public ChangeUnitWeight ( ) : bool
return bool

Execute() public method

Implement this method as an external command for Revit.
public Execute ( ExternalCommandData commandData, string &message, Autodesk elements ) : Autodesk.Revit.UI.Result
commandData ExternalCommandData An object that is passed to the external application /// which contains data related to the command, /// such as the application object and active view.
message string A message that can be set by the external application /// which will be displayed if a failure or cancellation is returned by /// the external command.
elements Autodesk A set of elements to which the external application /// can add elements that are to be highlighted in case of failure or cancellation.
return Autodesk.Revit.UI.Result

GetParameterTable() public method

get a datatable contains parameters' information of certain element
public GetParameterTable ( object o, MaterialType substanceKind ) : DataTable
o object Revit element
substanceKind MaterialType the material type of this element
return System.Data.DataTable

SetMaterial() public method

set the material of selected component
public SetMaterial ( ) : void
return void

UpdateMaterial() public method

Update cache material
public UpdateMaterial ( object obj ) : void
obj object new material
return void