Hello Forum,
I have a small problem with a Python node. I was trying to get Level elevations that match the Level names I already have on a list. The Level names are from a linked IFC model.
The script is from this forum post: Create MEP spaces from linked IFC - #25 by rolf.archi .
Unfortunately every time I run the script, the result is an Empty List. Since I am new with Python I haven’t found a possible solution.
The code:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
#Preparing input from dynamo to revit
names = IN[0]
#Do some action in a Transaction
levels = []
fec = FilteredElementCollector(doc).OfClass(Level).ToElements()
for l in fec:
for n in names:
if l.Name == n:
levels.Add(l)
OUT = levels
The Revit file was too big to upload here so the files are on this link: Dynamo - Google Drive
MEP_SpacesandRooms.dyn (26.0 KB)
Thank You in advance
Priit