LoadCombinationGetUsageIds Method |
Returns collection of the load combination usage IDs.
Namespace: Autodesk.Revit.DB.StructureAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic IList<ElementId> GetUsageIds()
Public Function GetUsageIds As IList(Of ElementId)
public:
IList<ElementId^>^ GetUsageIds()
member GetUsageIds : unit -> IList<ElementId>
Return Value
IListElementId
A collection of the load combination usage IDs.
Examplevoid 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()));
}
Private Sub ModifyLoadCombinationLoadCaseLoadUsageLoadNatureAndLoadComponent(document As Document, loadCombination As LoadCombination)
loadCombination.Name = "DL2 + RAIN1"
Dim case1 As LoadCase = Nothing
Dim caseAndCombinationIds As IList(Of ElementId) = loadCombination.GetCaseAndCombinationIds()
For Each id As ElementId In caseAndCombinationIds
Dim element As Element = document.GetElement(id)
If TypeOf element Is LoadCase Then
case1 = DirectCast(element, LoadCase)
Exit For
ElseIf TypeOf element Is LoadCombination Then
Continue For
End If
Next
If case1 Is Nothing Then
Throw New Exception("Can't get LoadCase.")
End If
case1.Name = "DL2"
If LoadCase.IsNumberUnique(document, 3) Then
case1.Number = 3
End If
Dim liveNature As LoadNature = LoadNature.Create(document, "Dead nature")
If liveNature Is Nothing Then
Throw New Exception("Create new load nature failed.")
End If
case1.SubcategoryId = New ElementId(BuiltInCategory.OST_LoadCasesDead)
case1.NatureId = liveNature.Id
Dim components As IList(Of LoadComponent) = loadCombination.GetComponents()
For Each loadComponent As LoadComponent In components
If loadComponent.LoadCaseOrCombinationId = case1.Id Then
loadComponent.Factor = 3.0
End If
Next
loadCombination.SetComponents(components)
Dim usages As IList(Of ElementId) = loadCombination.GetUsageIds()
usages.RemoveAt(0)
loadCombination.SetUsageIds(usages)
TaskDialog.Show("Revit", String.Format(, loadCombination.Id.ToString()))
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also