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:
  • Tristan Morgan

    Andrew, thanks for this!
    The match path component has solved a number of headaches.
  • Andrew Heumann

    I'm glad to hear it!

  • Peter Vikar

    thanks A, this node kind of saved my life:)
  • Jonatan Schumacher

    Thank you Andrew. These components are extremely useful!
  • Andrew Heumann

    Hey Jonatan, glad you find them useful! Funny that you should comment, I just watched your presentation with Robert Otani to the NYC Revit User Group two days ago -- really great stuff! I am very impressed, it is this kind of work that really exemplifies the power of Grasshopper!
  • Jonatan Schumacher

    Thanks a lot Andrew, that is great to hear. Yes, Grasshopper is a very powerful tool for engineers! Not only does it make our job more fun, but it also helps rationalize geometry for all sorts of analysis. That in conjunction with the many translators and addons (ssiTools, Firefly, Geco, Slingshot, Karamba, Kangaroo,...) that are being developed really changes the way that we interact with architects and fabricators.