Loads

Loads

The following sections identify load settings and discuss load limitation guidelines.

Load Settings

All functionality on the Setting dialog box Load Cases and Load Combinations tabs can be accessed by the API.

The following properties are available from the corresponding LoadCase BuiltInParameter:

Table 60 Load Case Properties and Parameters

Property

BuiltInParameter

Case Number

LOAD_CASE _NUMBER

Nature

LOAD_CASE_NATURE

Category

LOAD_CASE_CATEGORY

The LOAD_CASE_CATEGORY parameter returns an ElementId. The following table identifies the mapping between Category and ElementId Value.

Table 61: Load Case Category

Load Case Category

BuiltInCategory

Dead Loads

OST_LoadCasesDead

Live Loads

OST_LoadCasesLive

Wind Loads

OST_LoadCasesWind

Snow Loads

OST_LoadCasesSnow

Roof Live Loads

OST_LoadCasesRoofLive

Accidental Loads

OST_LoadCasesAccidental

Temperature Loads

OST_LoadCasesTemperature

Seismic Loads

OST_LoadCasesSeismic

The following classes have one or more static Create() methods create corresponding classes:

  • LoadUsage
  • LoadNature
  • LoadCase
  • LoadCombination.
  • PointLoad
  • LineLoad
  • AreaLoad

Because they are all Element subclasses, they can be deleted using Document.Delete().

The following example demonstrates how to create a Load Combination and how to find or create Load Cases and Load Natures to use to set the components of the Load Combination.

Code Region 29-14: Creating a new LoadCombination

LoadCombination CreateLoadCombinationLoadCaseLoadUsageLoadNatureAndLoadComponent(Document document)
{
    // Create a new load combination
    LoadCombination loadCombination = LoadCombination.Create(document, "DL1 + RAIN1", LoadCombinationType.Combination, LoadCombinationState.Ultimate);
    if (loadCombination == null)
        throw new Exception("Create new load combination failed.");

    // Get all existing LoadCase
    FilteredElementCollector collector = new FilteredElementCollector(document);
    ICollection<Element> collection = collector.OfClass(typeof(LoadCase)).ToElements();

    // Find LoadCase "DL1"
    LoadCase case1 = null;
    foreach (Element e in collection)
    {
        LoadCase loadCase = e as LoadCase;
        if (loadCase.Name == "DL1")
        {
            case1 = loadCase;
            break;
        }
    }

    // Get all existing LoadNature
    collector = new FilteredElementCollector(document);
    collection = collector.OfClass(typeof(LoadNature)).ToElements();

    // Find LoadNature "Dead"
    LoadNature nature1 = null;
    foreach (Element e in collection)
    {
        LoadNature loadNature = e as LoadNature;
        if (loadNature.Name == "Dead")
        {
            nature1 = loadNature;
            break;
        }
    }

    // Create LoadNature "Dead" if not exist
    if (nature1 == null)
        nature1 = LoadNature.Create(document, "Dead");

    // Create LoadCase "DL1" if not exist
    if (case1 == null)
        case1 = LoadCase.Create(document, "DL1", nature1.Id, LoadNatureCategory.Dead);

    // Create LoadNature "Rain"
    LoadNature nature2 = LoadNature.Create(document, "Rain");
    if (nature2 == null)
        throw new Exception("Create new load nature failed.");

    // Create LoadCase "RAIN1"
    LoadCase case2 = LoadCase.Create(document, "RAIN1", nature2.Id, LoadNatureCategory.Snow);
    if (case1 == null || case2 == null)
        throw new Exception("Create new load case failed.");

    // Create LoadComponents - they consist of LoadCases or nested LoadCombination and Factors
    List<LoadComponent> components = new List<LoadComponent>();
    components.Add(new LoadComponent(case1.Id, 2.0));
    components.Add(new LoadComponent(case2.Id, 1.5));

    // Add components to combination
    loadCombination.SetComponents(components);

    // Create LoadUsages
    LoadUsage usage1 = LoadUsage.Create(document, "Frequent");
    LoadUsage usage2 = LoadUsage.Create(document, "Rare");

    if (usage1 == null || usage2 == null)
        throw new Exception("Create new load usage failed.");

    // Add load usages to combination
    loadCombination.SetUsageIds(new List<ElementId>() {usage1.Id, usage2.Id});

    // Give the user some information
    TaskDialog.Show("Revit", string.Format("Load Combination ID='{0}' created successfully.", loadCombination.Id.IntegerValue));

    return loadCombination;
}

There is no Duplicate() method in the LoadCase and LoadNature classes. To implement this functionality, you must first create a new LoadCase (or LoadNature) object, and then copy the corresponding properties and parameters from an existing LoadCase (or LoadNature).

The following is a minimum sample code to demonstrate the creation of a point load in VB.NET:

Code Region 29-15: New PointLoad


'Define the location at which the PointLoad is applied. 
Dim point As New XYZ(0, 0, 4)
'Define the 3d force. 
Dim force As New XYZ(0, 0, -1)
'Define the 3d moment. 
Dim moment As New XYZ(0, 0, 0)

Dim pointLoad As PointLoad = pointLoad.Create(document, point, force, moment, Nothing, Nothing)