Combine same root branches

I have a number of objects, each object in it own branch, with a data structure as listed below. I want to combine the items that share the same root index. So I want all the Open Breps that start with 0 to be in the same branch (0;0 - 0;5 all go into the same branch), 1’s to be in the same branch, 2’s, and so on… How do I accomplish this?
Open Brep {0;0}
Open Brep {0;1}
Open Brep {0;2}
Open Brep {0;3}
Open Brep {0;4}
Open Brep {0;5}
Open Brep {1;0}
Open Brep {1;1}
Open Brep {1;2}
Open Brep {1;3}
Open Brep {1;4}
Open Brep {1;5}
Open Brep {2;0}
Open Brep {2;1}
Open Brep {2;2}
Open Brep {2;3}
Open Brep {2;4}
Open Brep {2;5}

1 Like

If I understand you correctly, use Flip Matrix.

Flip Matrix won’t work here due to the data structure.

@ken.marold You will either need to renumber the paths then Flip Matrix, use the Path Mapper, or you can take the easy (preferable) way and use the “Flip Last” component from Tree Sloth.

1 Like

Hey there !

Try the shift path component. Default value is -1, which will do what you want here : merge one row from right to left :slight_smile:

1 Like

Indeed, re-reading the post that is in fact what he wants. Trim Tree should also suffice.

1 Like

Try the component called “Trim Tree” it does exactly waht you want. You can also specify how many levels the tree should be trimmed.

I wonder what really differenciate these two components…
I believe trim is just to reduce branching, and shift path can also grow sub branches?

ShiftPaths is so called because it shifts the paths of neural connectivity in your brain so you are unable to explain what the ShiftPaths component actually does.
At the moment I am convinced it shifts the tree structure back to something similar to what it was before you plugged it into the previous component and sometimes this solves your problems.
The only cure is understanding PathMapper and there are special support groups for that.


Sorry if I do not get the right meaning of you reply (not english native speaker), but are you asking for shift path clarifications? :slight_smile:

I don’t think speaking English will help! The ShiftPaths component is a mystery only the finest Grasshopper minds can understand.

If anyone has a good explanation of what it does I’d be pleased to see it though!

I thought for a moment you were using irony, which I’ve trouble to spot in English :wink:

Shift Path is basically used to reduce the complexity of a tree (or at least it’s the use I make of it). A negative offset of 1 means that all the data in the outer branches will be merged into the branch that are closer to the root.
You can use other negative values than 1, shift path will then shift the data “that other negative value” of time closer to the root. damn english.
If you use positive offset values, you will reduce the complexity from the root to the outer branches.

I can come up with an example if needed, a bit later, just tell me if this is not clear enough (and I beleive it’s not clear). Examples are always the best. :slight_smile:

yeah an example is always useful and there was probably some attempt at humour in my post :slight_smile:

I understand your explanation but it would be good to have it with an example that shows why one would need to use shift paths. I’ll try and find a definition where I’ve used it in the past.

1 Like

Flip Last component worked like a charm for me.

Shift Path is pure magic! Thank you!