Structural Columns, Beams and Braces

Structural Columns, Beams and Braces

Structural column, beam, and brace elements are all represented by the FamilyInstance class. They are distinguished by the StructuralType property.

Code Region 29-1: Distinguishing between column, beam and brace

public void GetStructuralType(FamilyInstance familyInstance)
{
    string message = "";
    switch (familyInstance.StructuralType)
    {
        case StructuralType.Beam:
            message = "FamilyInstance is a beam.";
            break;
        case StructuralType.Brace:
            message = "FamilyInstance is a brace.";
            break;
        case StructuralType.Column:
            message = "FamilyInstance is a column.";
            break;
        case StructuralType.Footing:
            message = "FamilyInstance is a footing.";
            break;
        default:
            message = "FamilyInstance is non-structural or unknown framing.";
            break;
    }

    TaskDialog.Show("Revit",message);
}

You can filter out FamilySymbol objects corresponding to structural columns, beams, and braces by using categories. The category for structural beams and braces is BuiltInCategory.OST_StructuralFraming. The category for structural columns is BuiltInCategory.OST_StructuralColumns.

Code Region 29-2: Using BuiltInCategory.OST_StructuralFraming

public void GetBeamAndColumnSymbols(Document document)
{
    List<FamilySymbol> columnTypes = new List<FamilySymbol>();
    List<FamilySymbol> framingTypes = new List<FamilySymbol>();
    FilteredElementCollector collector = new FilteredElementCollector(document);
    ICollection<Element> elements = collector.OfClass(typeof(Family)).ToElements();

    foreach(Element element in elements)
    {
        Family family = element as Family;
        Category category = family.FamilyCategory;
        if (null != category)
        {
            ISet<ElementId> familySymbolIds = family.GetFamilySymbolIds();
            if ((int)BuiltInCategory.OST_StructuralColumns == category.Id.IntegerValue)
            {
                foreach (ElementId id in familySymbolIds)
                {
                    FamilySymbol symbol = family.Document.GetElement(id) as FamilySymbol;
                    columnTypes.Add(symbol);
                }
            }
            else if ((int)BuiltInCategory.OST_StructuralFraming == category.Id.IntegerValue)
            {
                foreach (ElementId id in familySymbolIds)
                {
                    FamilySymbol symbol = family.Document.GetElement(id) as FamilySymbol;
                    framingTypes.Add(symbol);
                }
            }
        }
    }

    string message = "Column Types: ";
    foreach (FamilySymbol familySymbol in columnTypes)
    {
        message += "\n" + familySymbol.Name;
    }

    TaskDialog.Show("Revit",message);
}

You can get and set beam setback properties with the FamilyInstance.ExtensionUtility property. If this property returns null, the beam setback can't be modified.

BeamSystem

BeamSystem provides full access and edit ability to beam systems. You can get and set all of its properties, such as BeamSystemType, BeamType, Direction, and Level. BeamSystem.Direction is not limited to one line of edges. It can be set to any XYZ coordinate on the same plane with the BeamSystem.

Note: You cannot change the StructuralBeam AnalyticalModel after the Elevation property is changed in the UI or by the API. In the following picture the analytical model lines stay in the original location after BeamSystem Elevation is changed to 10 feet.

Figure 156: Change BeamSystem elevation