Split Tree While Keeping Empty Branches?

I need to split a tree based on a condition that only certain branches satisfy. However, I still want to preserve the original tree structure, meaning that branches that do not satisfy the condition should remain in place as empty branches.

This is similar to how Sift Pattern works when splitting a list, where null items are preserved.

The only workaround I’ve found so far is to manually remove all items from the branches I don’t want, leaving those branches empty. However, I feel like there should be a simpler and more straightforward way to achieve this, and I may be missing something.

Data Tree.gh (17.9 KB)

Nope, just work arounds. I feel like at the beginning, David wasn’t sure whether keep nulls and empty branches or no. It’s somewhat inconsistent:

Cull Pattern


Data Tree_CullPattern.gh (24.1 KB)

Me using Cull Pattern in all three solutions. Me also forgetting longest list input matching… right… :person_facepalming: