If node error

If node returns not all items of the list depends on other option’s number of items.
why does it happen???

see the image below

This is because of how the If node deals with lists in general.

One possible solution to try (though I haven’t tried it myself): use dictionaries instead of lists. Theoretically they are both single items, even if they have varying number of items.

If that fails, make a dictionary from both lists and pass either the true key or the false key, and use that to get the correct set of data from the dictionary.

1 Like

making a list as an item works…
but the error should be corrected.


Use the node: “ScopeIf”

oh, it’s better.
Thanks. :slight_smile:

all above solutions don’t work for me at last…
so I found another workaround.

Thanks guys.

I got so anoyed by the IF node that I either use a python script to do it or a design script node:

# Enable Python support and load DesignScript library
import clr
from Autodesk.DesignScript.Geometry import *

ToF = IN[0]
List1 = IN[1]
List2 = IN[2]

Result = []

if ToF == True:

flat_List1 = [item for sublist in Result for item in sublist]

OUT = flat_List1

Design Script
result = [TrueVal, FalseVal];
result[ToF ? 0 : 1];

1 Like

it’s also useful.