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

image

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

Hi Priit,

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

Best regards
Rolf

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
Priit

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:
https://we.tl/t-9DsXFnAO3i

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

Result:

Best regards
Rolf

Hi Rolf

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

Thank You for Your help.

Best Regards
Priit