Create Level by Elevation and Name with Python

I am trying to create levels using ByElevationAndName revit node using python script.
Goal here is to convert the unit based on a string input (I or M) and create levels at the correct elevations,
but can’t seem to figure out why I keep getting an error “AttributeError: ‘type’ object has no attribute ‘ByElevationAndName’”

Level name, elevation and the the units are from an excel file.

1 Like

Hey,

Maybe this helps? Just some dummy numbers and things while I was digging around… The use of an alias and removing ‘Create’ are, I think, what you’re after…

If I get stuck, I tend to go back to the most simple example I can :slight_smile:

import clr
clr.AddReference('RevitNodes')
import Revit.Elements as RE


clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument


TransactionManager.Instance.EnsureInTransaction(doc)

OUT = RE.Level.ByElevationAndName(30, "Test3")


TransactionManager.Instance.TransactionTaskDone()

Cheers,

Mark

1 Like

Thanks!