GetNearestLevelId Method (Document, Double, Double)


Returns id of the Level which is closest to the specified elevation.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2022

Syntax

C#
public static ElementId GetNearestLevelId(
	Document document,
	double elevation,
	out double offset
)
Visual Basic
Public Shared Function GetNearestLevelId ( _
	document As Document, _
	elevation As Double, _
	<OutAttribute> ByRef offset As Double _
) As ElementId
Visual C++
public:
static ElementId^ GetNearestLevelId(
	Document^ document, 
	double elevation, 
	[OutAttribute] double% offset
)

Parameters

document
Type: Autodesk.Revit.DB Document
The document.
elevation
Type: System Double
Target Elevation.
offset
Type: System Double %
Vertical offset from the level to the target elevation.

Remarks

The level can be at, above or below the target elevation. If there is more than one Level at the same distance from the elevation, the Level with the lowest Id will be returned.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null

See Also