Combine list based on boolean list


#1

Hi all

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

List

 

 

 

 

 

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

IF

 

 

 

 

 

Any advice would be much appreciated

 


#2

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:

2015-10-30_10-52-12

 

 

 

 


#3

That’s so awsome Dimitar

Thank you so much!


#4

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