For given Wall types, when we click on the Structure parameter, it displays a dialog which lists all the CompoundStructure layers and their associated data like Width, Function, Material, etc. It also includes checkbox which refers to a layer whose material defines the structural properties of the type for the purposes of analysis.
Using the API, we can find out which layer (index) has the checkbox checked. The following minimal lines of code shows how to access this information.
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.HelloRevit.CS
{
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
foreach (Element ele in
commandData.Application.ActiveUIDocument.Selection.Elements)
{
Wall wall = ele as Wall;
CompoundStructure structure =
wall.WallType.GetCompoundStructure();
TaskDialog.Show(
"Str Material Index",
structure.StructuralMaterialIndex.ToString());
}
return Result.Succeeded;
}
}
}
Using this code, and testing it with Basic Wall Exterior – Brick on CMU Mtl Stud., the above mentioned code returns the layer with the Structural Material index to be 5. Since this is a 0-based index, it displays the expected results which we can confirm from the dialog shown above – the layer with Structure[1] function is the 5th layer which has this check box in checked state.
If there are no layers which have the checked boxes for the Structural Material, the code included above returns a value of –1.