The create method in RevitAPI say that I need “the document” and “a string” to create a new phasefilter.
So I made this python script : (IN[0] = string)
# document
doc = DocumentManager.Instance.CurrentDBDocument
# if input is not a list , make a list
names = IN[0] if isinstance(IN[0],list) else [IN[0]]
# for output result
result = []
# transaction open
TransactionManager.Instance.EnsureInTransaction(doc)
# loop each name
for name in names:
result.append(PhaseFilter.Create(doc, name))
# transaction close
TransactionManager.Instance.TransactionTaskDone()
OUT = result
hi @BenBimlogic, it means, If IN[0] is a list, you just take it. Else(if not a list) make/convert IN[0] a list.
And there are so many different ways of writing. What matters is logic.