Creates a new instance of level based on an input elevation.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Parameters
- document
- Type: Autodesk.Revit.DB Document
The document in which the new instance is created
- elevation
- Type: System Double
The elevation of the level to be created.
Return Value
The newly created level instance.Examples

Level CreateLevel(Autodesk.Revit.DB.Document document)
{
// The elevation to apply to the new level
double elevation = 20.0;
// Begin to create a level
Level level = Level.Create(document, elevation);
if (null == level)
{
throw new Exception("Create a new level failed.");
}
// Change the level name
level.Name = "New level";
return level;
}

Private Function CreateLevel(document As Autodesk.Revit.DB.Document) As Level
' The elevation to apply to the new level
Dim elevation As Double = 20.0
' Begin to create a level
Dim level As Level = level.Create(document, elevation)
If level Is Nothing Then
Throw New Exception("Create a new level failed.")
End If
' Change the level name
level.Name = "New level"
Return level
End Function
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions ArgumentNullException | A non-optional argument was null |