CompoundStructureLayerMaterialId Property |
Id of the material assigned to this layer.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic ElementId MaterialId { get; set; }Public Property MaterialId As ElementId
Get
Set
public:
property ElementId^ MaterialId {
ElementId^ get ();
void set (ElementId^ value);
}member MaterialId : ElementId with get, set
Property Value
ElementId
The default is InvalidElementId.
Exceptions
Examplepublic void GetWallLayerMaterial(Autodesk.Revit.DB.Document document, Wall wall)
{
WallType aWallType = wall.WallType;
if (WallKind.Basic == aWallType.Kind)
{
CompoundStructure comStruct = aWallType.GetCompoundStructure();
Categories allCategories = document.Settings.Categories;
Category wallCategory = allCategories.get_Item(BuiltInCategory.OST_Walls);
Autodesk.Revit.DB.Material wallMaterial = wallCategory.Material;
foreach (CompoundStructureLayer structLayer in comStruct.GetLayers())
{
Autodesk.Revit.DB.Material layerMaterial = document.GetElement(structLayer.MaterialId) as Material;
if (null == layerMaterial)
{
switch (structLayer.Function)
{
case MaterialFunctionAssignment.Finish1:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsFinish1).Material;
break;
case MaterialFunctionAssignment.Finish2:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsFinish2).Material;
break;
case MaterialFunctionAssignment.Membrane:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsMembrane).Material;
break;
case MaterialFunctionAssignment.Structure:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsStructure).Material;
break;
case MaterialFunctionAssignment.Substrate:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsSubstrate).Material;
break;
case MaterialFunctionAssignment.Insulation:
layerMaterial =
allCategories.get_Item(BuiltInCategory.OST_WallsInsulation).Material;
break;
default:
break;
}
if (null == layerMaterial)
{
layerMaterial = wallMaterial;
}
}
TaskDialog.Show("Revit","Layer Material: " + layerMaterial);
}
}
}
See Also