Data Tree Utilities: Match Path and Partial Flatten

In the coming weeks, I am planning to release some clusters I've put together for use, and I thought I'd start with two that correspond to common operations I perform on data trees.

The first, Match Path, takes a flat list of data with N items, and another list of data with N items with some kind of arbitrary tree structure. The output is the first flat list, reconfigured to match the path structure of the input list. I was inspired to create this one by a post on the Grasshopper board by Arie-Willem de Jongh (here).

The second, Partial Flatten, takes a set of data with a tree structure and flattens the N lowermost levels of hierarchy. This has been requested a number of times as a built-in feature on the GH board - (see this thread for one example) but until it's implemented this cluster will have to do.

Both tasks can be accomplished on an individual basis with the path mapper, but the problem with the path mapper in general is that changes to the data structure upstream require editing all downstream path mappers to get everything to work. The two clusters I am posting here avoid the use of path mappers entirely, so they will perform the same functions even if the structure upstream changes.

download both clusters here:
Load Previous Comments
  • castroecosta

    Thank you thank you THANK YOU!

    I've been trying to do partial flatten for quite some time!

  • Andrew Heumann

    Hi Castro - just FYI, this is now a built-in feature of grasshopper with the "shift paths" component.
  • castroecosta

    lol!

    indeed...

    well thanks anyway :)