How to re-order Tree Branches

Dear All

Please excuse my simple question. I have a simple case here consisting of 2 branches {0} & {1}.

All I need to do is to change their orders so that {0} becomes {1}.

I have tried reverse list but that obviously wasn’t the correct choice.
Much appreciate if some kind hearts could lend a hand on this.

I have attached the script herewith. Many thanks in advance!

Kind regards
Yuatakatree branch renumber question.gh (4.7 KB)

like this?

tree branch renumber question_sg.gh (5.3 KB)

Hi Gijs

Yes this is exactly what I need, you are a genius. Can I assume that if the tree has more indexes, I will hae to reorder them one by one this way or would there be a single command that simply reorders from front to back with one step?

Many thanks!

I’m not saying there isn’t another way, but I don’t know to do it other than I posted.

This works…
reorder branches.gh (3.2 KB)

Check this as well.
For this to work, you should uncheck “Maintain Path” option ofTree Branch component to “Renumber” via RMB popup menu .

tree branch renumber question_re.gh (9.3 KB)

Hi Gijs

Thank you for the options! much appreciated!

Hi HS Kim

Thank you very much, that does the job just as I needed, thank you for your help! much appreciated!