NewLoadUsage Method


Creates a new instance of a LoadUsage element within the project.

Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public LoadUsage NewLoadUsage(
	string name
)
Visual Basic
Public Function NewLoadUsage ( _
	name As String _
) As LoadUsage
Visual C++
public:
LoadUsage^ NewLoadUsage(
	String^ name
)

Parameters

name
Type: System String
The not empty name for the Load Usage Element to create.

Return Value

If successful and there isn't the Load Usage Element with the same name NewLoadUsage returns an object for the newly created LoadUsage. If such element exist it returns existing element. a null reference ( Nothing in Visual Basic) is returned if the operation fails.

Examples

Copy C#
// Create some Load usages and add them into an array
LoadUsage usage1 = document.Create.NewLoadUsage("Usage one");
LoadUsage usage2 = document.Create.NewLoadUsage("Usage two");

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

LoadUsageArray loadUsages = new LoadUsageArray();
loadUsages.Append(usage1);
loadUsages.Append(usage2);
Copy VB.NET
' Create some Load usages and add them into an array
Dim usage1 As LoadUsage = document.Create.NewLoadUsage("Usage one")
Dim usage2 As LoadUsage = document.Create.NewLoadUsage("Usage two")

If usage1 Is Nothing OrElse usage2 Is Nothing Then
    Throw New Exception("Create new load usage failed.")
End If

Dim loadUsages As New LoadUsageArray()
loadUsages.Append(usage1)
loadUsages.Append(usage2)

Exceptions

Exception Condition
Autodesk.Revit.Exceptions InvalidOperationException If the product is not Revit Structure.

See Also