Flatten Tree up to Branch?

I’m trying to dispatch the branches in a tree in the following way:

Basically, at branch N, I would like all the contents of the tree up to this branch (all items where Branch<N) to be merged together, so I tried Split Tree with different splitting masks, hoping that I could flatten the output afterwards.

I tried everything but at the end the problem is the same: the tree branches add up, and since the branch {0} is picked 12 times, I have 12 items in {0} but it doesn’t dispatch the content of the branch in {0,1,2,…11} like I wanted.

What am I doing wrong?
Thank you so much!

Ultimately I would like to find a way to stack several breps which are currently patches hanging in thin air, as if they were subjected to gravity. I posted the explanation of what I’m trying to do with no success so far here. I realize it’s quite a stretch, so I figured I would first need to find, for each layer, where is the nearest bottom surface underneath.

DispatchTreeBranchGradually_Question.gh (317.8 KB)

Hi @biotop

I believe this is what you’re looking for.

File: 2021.12.08_FlattenTreeUptoBranch.gh (8.5 KB)


~ ~ ~ ~ ~ ~ ~ ~
Kaushik LS
Chennai, IN

DispatchTreeBranchGradually_Question_re.gh (617.2 KB)

Thank you both @HS_Kim and @Kaushik for your replies. @HS_Kim 's solution is exactly what I was looking for! I didn’t think about flattening all and repartitioning afterwards.
@Kaushik it doesn’t really seem to work with my geometry actually, the same problem appears. But thank you as well.

1 Like