Combine list based on boolean list


Hi all

is it possible to combine two list, based on one list of booleans? see image for wanted result.







i’ve tried using the if node, but i only get two results in my list, see image







Any advice would be much appreciated



I don’t believe there’s a straight-forward way to solve this with nodes, so you’ll need to resort either to python or to a custom DS function.

The problem lies in the fact that the three lists (Boolean values, true values, false values) are all different lengths and there is no logical way for Dynamo to map the values to one another. This is also why the built-in if node outputs only two results because your shortest list has only two values. Here’s a basic python script that uses an external counter to remember the correct position in each true/false list:







That’s so awsome Dimitar

Thank you so much!


A node based solution now seems possible using one of the current builds.