Get tree path/branch that contains a certain item

It MUST have been already answered because the problem seems simple to me, but I can’t find it and I’ve spent time scourging the forum.
I have to VERY irregularly shaped trees but with consistent key-value pairs and I want to select the value of a tree from the key of the other.
If I can get the path of the key I can use it to select the value of the other, but I can’t fathom how to do it.
Any help would be apppreciated. Thanks in advance.

Is this What you are Looking for?

Find ItemPath-Index.gh (8.1 KB)

Not really.
That is getting the occurrence of a certain item, I need to get the branch path to use it on another tree to select these certain branches.


I made a temporary solution, but I had to flatten the original tree and use a path mapper to get the branch path that conforms to the condition.
My wonder is if there is a node that can do ALL this at once.

So if I understand correctly from the snippet you put here, It seems you want to get the treeBranch information for “Key”. And then use the branch information to access another data Tree. Right?

If so, then all you have to add in the previous script is a param viewer to get the branch Paths
Here is a sample
Find ItemPath-IndexV1.gh (12.2 KB)

1 Like

Couldn’t make your example fit my needs, but thanks a lot anyway.
I think my approach was a little more “economical”
Anyway my goal was to make it in just one component if it existed already.

Hi @arquitextonica, What you want is not available as a standard component in GH.
Here is a custom C# Component that find the branch a data is on, taking out all the other steps in between.

Let me know if it works for your task.
Find Path.gh (6.2 KB)

2 Likes

Thanks a lot! Wonder if @DavidRutten thinks it could be a useful capability to implement in a future standard component for #GH2?

It’s not as straight forward as what @su.lwpac recommended:


FindPath.gh (21.0 KB)

3 Likes