Python script resulting in Empty List

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 .
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

from Autodesk.Revit.DB import *

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:
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

Hi Priit,

please upload the entire rvt project with the linked ifc file (relative path type).

Best regards

Hi Rolf

I don’t know if I understood You correctly but in addition to the Revit file, I added the linked IFC to the Google Drive folder.

Best Regards

Return just fec and then get the names of those levels to confirm that you have matching names.

Hi Priit,

the entire rvt project as zip:

I took over the levels from the ifc and then started the script.


Best regards

Hi Rolf

Sorry for the late answer. Now the script worked fine.

Thank You for Your help.

Best Regards