@maldemu96 so you got the expected result?
The if penetrationtype... test and following lines are indented and will be causing a syntax error
On to a solution…
The flatten function needs to handle the edge cases - a string, a single value, a list of length 1
def flatten(items):
def is_iterable(item):
return hasattr(item, "__iter__") and not isinstance(item, str)
if is_iterable(items):
out = []
for i in items:
if is_iterable(i):
out.extend(flatten(i))
else:
out.append(i)
if len(out) == 1:
return out[0]
return out
return items
Then map the function across the input
(
hvactypecombined,
penetrationtype,
penetrationheight,
penetrationwidth,
penetrationdiameter,
wallmaterial,
walldepth,
firerating,
hvactype,
) = map(flatten, IN)
To handle the diameter we don’t need the if... else as it’s already set to 0 or some other value and I’m confused because if it is rectangular we set the diameter to 0, that’s OK - if it’s not rectangular (i.e. circular or oval) we are setting the diameter to half the maximum of width or height, so this will be the radius? Why not just set the diameter?
I set it zero just to create the code and some parameters are not involved yet. It is atm just a placeholder.
Hi @maldemu96,
Please try using this example:
Picture 1: This is a simple example that demonstrates how to flatten multiple lists using nodes.
Picture 2: This will give you an idea of how to set the levels.


