Is there a way to merge list 1 and list 2 while ‘replacing’* the values from the bool true = list 1 and false = list 2 and keeping all the sublists from the bool?
*not actually replacing since these are other elements, but somehow putting in the same place as the bool list.
Hello @Laura_POLO
a solution with Python
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
boolLst = IN[0]
iterTrue = iter(IN[1])
iterFalse = iter(IN[2])
OUT = [[next(iterTrue) if val else next(iterFalse) for val in sublst] for sublst in boolLst]
3 Likes
@Vikram_Subbaiah Thanks for this solution with nodes, I’ll try it out later next week.
For now the python works great for me.
1 Like