I recently stumbled apon the Revit APP blog and spotted a simple code listing for getting all level elevations. This should be a no-brainer using the RevitPythonShell (RPS), so I fired up a shell and started typing. This is a session transcript in the shell:
>>>import clr >>>clr.AddReference('RevitAPI') >>>import Autodesk.Revit.DB >>>collector = Autodesk.Revit.DB.FilteredElementCollector(__revit__.ActiveUIDocument.Document) >>>elems = collector.WhereElementIsNotElementType().OfClass(Autodesk.Revit.DB.Level).ToElements() >>>for lv in elems: ... print '%s: %.2f' % (lv.Name, lv.Elevation) ... Level 1: 0.00 Level 2: 9.84 >>>
I am getting a bit fed up of typing import clr and referencing RevitAPI whenever I use RPS so my next step will be to try and add that by default. I'll keep you posted about that.