GetNearestLevelId Method (Document, Double)


Level Get Nearest Level Id(Document, Double) Method

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

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public static ElementId GetNearestLevelId(
	Document document,
	double elevation
)

Parameters

document Document
The document.
elevation Double
Target Elevation.

Return Value

ElementId
Exceptions
Exception Condition
ArgumentNullException A non-optional argument was null
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.
See Also
ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →