Creates a new instance of a LoadCase element within the project.
Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Syntax
Return Value
If successful, NewLoadCase and there isn't the Load Case Element
with the same name returns an object for the newly created LoadCase.
If such element exist and match desired one (has the same nature and number),
returns existing element. Otherwise
nullNothingnullptra null reference (Nothing in Visual Basic) is returned.
Examples
CopyC#
LoadCase CreateLoadCase(Autodesk.Revit.DB.Document document, Category category, LoadNature nature)
{
LoadCase loadCase = document.Create.NewLoadCase("new case", nature, category);
if (null == loadCase)
{
throw new Exception("Create a new load case failed.");
}
TaskDialog.Show("Revit","Successfully created a load case.");
return loadCase;
}
CopyVB.NET
Private Function CreateLoadCase(document As Autodesk.Revit.DB.Document, category As Category, nature As LoadNature) As LoadCase
Dim loadCase As LoadCase = document.Create.NewLoadCase("new case", nature, category)
If loadCase Is Nothing Then
Throw New Exception("Create a new load case failed.")
End If
TaskDialog.Show("Revit", "Successfully created a load case.")
Return loadCase
End Function
Exceptions
See Also