Hello,
I need to renumber a tree as follows :
…
Well, please look at my attachments.
For now i made it with VB code. But i’d like to developp it with GH components, such as Path Mapper.
Thanks in advance
JL
Hello,
I need to renumber a tree as follows :
…
Well, please look at my attachments.
For now i made it with VB code. But i’d like to developp it with GH components, such as Path Mapper.
Thanks in advance
JL
I don’t cleary know what you want from that picture. So I think you want that the marked number of the Output = marked number of Input. If that’s what you want, may have a look at this.
renumber tree_1.gh (17.0 KB)
In fact the output tree I want is exactly what is shown in the screenshot.
The VB component does the job well… but i don’t want VB component.
Wow! That’s it
I was working on a similar logic to HS_Kim, using sets but as all your branches in the original tree are the same length i think it can be shorted to this. If they are various lengths in a larger code and mixed up your would just need to add a Member Index and an item to sort the path lengths before the partition component
renumber tree components.gh (9.9 KB)
Ok I see where i was wrong, Updated and even simpler as you can use the numbers to set the paths directly.
renumber tree components -update.gh (13.7 KB)
Indeed, it’s shorter.
And much faster also (i tested your code with some big tree).
Thank you!
Oh ok sorry, than I got you wrong
Even when there is a really great and short solution, here’s another
Thanks, Tim
Metahopper and Treefrog provide a rich toolset for expressing these kinds of dynamic path assignment operations:
renumber tree.gh (8.8 KB)