用戶可以使用HostObjAttributes.GetCompoundStructure()這個方法來獲取複合結構 CompoundStructure。
其中 HostObjAttributes 的子類包括有:WallType,FloorType 和RoofType。
而 CompoundStructure. GetLayers()方法可以用來獲取 CompoundStructureLayer,也就是每一層的信息,從而進一步獲取每層的材質、厚度、功能等信息。void GetWallMaterial(Autodesk.Revit.DB.Document RevitDoc)
{
Wall wall = RevitDoc.GetElement(new ElementId(732980)) as Wall;
CompoundStructure compoundStructure = wall.WallType.GetCompoundStructure();
if (compoundStructure == null)
return;
if (compoundStructure.LayerCount > 0)
{
foreach (CompoundStructureLayer compoundStructureLayer in
compoundStructure.GetLayers())
{
//獲取材質和厚度
ElementId materialId = compoundStructureLayer.MaterialId;
double layerWidth = compoundStructureLayer.Width;
}
}
}
=========【更多高級應用請關注公衆號】========
==================================