Hi All,
I have a fairly simple python script that accepts a list of schedules for input but the output is one list instead of multiple lists (to match the number of schedules). The current output is correct except for the number of lists. I think I’m missing square brackets somewhere but maybe it’s something else. Any help would be appreciated. Thanks
Hi @paliitali,
You need a list inside the first loop to which you append what you collect in the inner loop. This list you then append to hidden.
Something like this:
newlst = []
for i in x:
temp = []
for j in i:
temp.append(j)
newlst.append(temp)
1 Like
When I try to add a list in the loop, I get an error “iteration over non-sequence type”.
Try uploading a screenshot of your graf with preview shown of your input list.
See if this works for you:
import clr
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#---###Start scripting here:###---#
sche = UnwrapElement(IN[0])
names = []
hidden = []
for i in sche:
temp_names = []
temp_hidden = []
definition = i.Definition
fieldorder = definition.GetFieldOrder()
for j in fieldorder:
param = definition.GetField(j)
temp_names.append(param.GetName())
temp_hidden.append(param.IsHidden)
names.append(temp_names)
hidden.append(temp_hidden)
OUT = names, hidden
2 Likes
Thank you @MartinSpence. The script worked and I can see what was needed and where I went wrong. I appreciate the help.
2 Likes