FindLevelByName
Level? FindLevelByName(this Document doc, string name)Finds the first level by name (case-insensitive). Returns null if not found.
Parameters
- docDocument
The Revit document instance.
- namestring
The level name to search for.
Returns: The matching Level if found; otherwise null.
Example
Level? level = doc.FindLevelByName("Level 1");if (level != null){ TaskDialog.Show("Found Level", level.Name);}