Hi,
i try to understand how i can search things that are equal with Python. For example the get level by name.
I made the following code but i doesn’t give me the matching result with the name and the output level
Thanks!
import clr
# Import RevitAPI
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
DataEnteringNode = IN
levelName = IN[0]
level = None
#The inputs to this node will be stored as a list in the IN variable.
lName = FilteredElementCollector(doc).OfClass(Level).ToElements()
for i in lName:
if i.Name == levelName:
level = i
break
else:
level = None
OUT = level