Filter and recombine on nested lists

Hello everyone,

I have an issue regarding the filter node in Dynamo, which does not keep the original order of elements after filtering.

I really need this because I want to filter a nested list of points with the purpose to modify only some of them and after that I want to recombine the list with the not-modified points, in order to redraw the new-form modified line.
Right now, the ListFilterByBoolMask Node is filtering without keeping the elements position and then when I rejoin the with ListJoin node, it makes two separate nested lists: one for the “IN” output and one for the “OUT” output.

In fact, in Grasshopper, there is a component who does exactly this(Dispatch), keeping the filtered elements in place as empty list. It is possible to do this in Dynamo?

Best regards,
Alex

If you don’t mind working with something other than empty lists (null in example below) than this may be a viable approach:

Or similar syntax in DesignScript:

1 Like

Replace By Condition:

Yes, nice solution, but the problem is that I need two outputs, one for the IN list with the null list, and the other for OUT, also with the null list mixed in.

Can you share a little more of your graph so we can see your intent? Maybe we can find another way of structuring the graph?

Yeah, sure! This is a bigger picture of the definitions.

In fact, the final goal is to reunify all the points seen in the background for each curve, this is why I need to keep the list order.