LoadCombinationGetComponents Method |
Returns collection of the load combination components.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic IList<LoadComponent> GetComponents()
Public Function GetComponents As IList(Of LoadComponent)
public:
IList<LoadComponent^>^ GetComponents()
member GetComponents : unit -> IList<LoadComponent>
Return Value
IListLoadComponent
A collection of the load combination components.
Example#region Autodesk.Revit.DB.Structure.LoadCombination.GetUsageIds()
void ModifyLoadCombinationLoadCaseLoadUsageLoadNatureAndLoadComponent(Document document, LoadCombination loadCombination)
{
loadCombination.Name = "DL2 + RAIN1";
LoadCase case1 = null;
IList<ElementId> caseAndCombinationIds = loadCombination.GetCaseAndCombinationIds();
foreach (ElementId id in caseAndCombinationIds)
{
Element element = document.GetElement(id);
if (element is LoadCase)
{
case1 = (LoadCase)element;
break;
}
else if (element is LoadCombination)
{
continue;
}
}
if (case1 == null)
throw new Exception("Can't get LoadCase.");
case1.Name = "DL2";
if (LoadCase.IsNumberUnique(document, 3))
{
case1.Number = 3;
}
LoadNature liveNature = LoadNature.Create(document, "Dead nature");
if (liveNature == null)
throw new Exception("Create new load nature failed.");
case1.SubcategoryId = new ElementId(BuiltInCategory.OST_LoadCasesDead);
case1.NatureId = liveNature.Id;
IList<LoadComponent> components = loadCombination.GetComponents();
foreach (LoadComponent loadComponent in components)
{
if (loadComponent.LoadCaseOrCombinationId == case1.Id)
{
loadComponent.Factor = 3.0;
}
}
loadCombination.SetComponents(components);
IList<ElementId> usages = loadCombination.GetUsageIds();
usages.RemoveAt(0);
loadCombination.SetUsageIds(usages);
TaskDialog.Show("Revit", string.Format("Load Combination ID='{0}' modified successfully.", loadCombination.Id.ToString()));
}
#endregion
See Also