I want to split the list using a Boolean list as shown in the image.
These should be split before False.
Is there any solution?
Use Node : AllIndicesOF and feed it with True of false to get the relative ,then GetItemAtIndex to get the ture of false list items.
Or Use Filter by Bool Mask.
Do you have any reference images?
Is this a description of List.FilterByBoolMask?
Yes
Can you tell me how to do this exactly?
I would like to have such a list, so the above does not solve the problem.
Here, just insert the code bellow into a Python Script node, you can create a custom node afterwards to keep using it repeatedly.
main_list = IN[0]
bool_list = IN[1]
falseindices = []
count = 0
for bool in bool_list:
if bool == False and count != 0:
falseindices.append(count)
count += 1
res = [main_list[i : j] for i, j in zip([0] + falseindices, falseindices + [None])]
OUT = res
Thank you!
But can this be solved only with Dynamo without using Python?
You can wrap that Python Script into a custom node…
That being said, the requested result is kinda custom, I don’t think I would bother to figure out a way to do it with built-in nodes…
Yes, it is possible. You can use OOTB option or the node from Sastrugi package as shown.
SplitList.dyn (22.8 KB)