Searching for equalities between two tree's branches, doesn't return desired result

unhandled

(Janis Goldmanis) #1

Hello!

I thought I had gotten the hang of using grasshopper trees, but something basic doesn’t work for me as I want…

I have two trees, each with 6 branches. {0}…{6}

I want to find out, if any value from first tree’s branch is in relative branch of second tree.

If I compare only single branch to single branch, it gives me desired output. For example branch {1}.

But if I try to compare both lists directly, with grafting one, it doesn’t work.

I tried comparing both lists, which didn’t work.
Feeding only one list did work, so I tried to create series list, trying to recreate the effect, but this worked the same as comparing both lists directly, which didn’t work.

When comparing both lists directly, grafting one, I thought it would work like this:
Tree 1, branch {0} has three values. I graft it, creating {0,0}, {0,1} and {0,1}

I want it to be compared to Tree 2, branch {0}, which has three values.

This works, if I’m working just with these branches.

However, when I try to automatize the effect for all branches, it compares Tree 1 {0,0} with Tree 2 branch {0}, Tree 1 {0,1} with Tree 2 branch {1} and Tree 1 {0,2} with Tree branch {2}.

I can’t understand why it works, when comparing single branches, and doesn’t work, when I add additional branches with series.

My definition (problem place is in green zone):
GH Trees not working v1.gh (34.4 KB)

Thank you for any help!
Best regards,
Janis


(Janis Goldmanis) #2

I tried to solve this for ~2 days, and of course, right after posting, it seems I found an answer… :slight_smile:

I think “Set Intersection” component works for me.
At least for smaller controlled tests it achieved desired result, gonna try to put in main definition.