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
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.
making a list as an item works…
but the error should be corrected.
Thanks
oh, it’s better.
Thanks.
I got so anoyed by the IF node that I either use a python script to do it or a design script node:
python
# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
ToF = IN[0]
List1 = IN[1]
List2 = IN[2]
Result = []
if ToF == True:
Result.append(List1)
else:
Result.append(List2)
flat_List1 = [item for sublist in Result for item in sublist]
OUT = flat_List1
Design Script
result = [TrueVal, FalseVal];
result[ToF ? 0 : 1];
it’s also useful.
Thanks.