Search for specific items in a data tree and create two new ones

Hello guys,
i need to split the data tree output of the “plane origin” component. Specifically, i need to search all items that have a common origin O(xxx;xxx;xxx) but have opposite Z (xxx;xxx;xxx).
As you see on the screenshot, they are all the planes associated to N objects. Items are the planes and objects are my branches. I need to find those that have common origin but opposite normal (ex: item 24 and 25 in the first branch and 6 and 7 in the second one). In the screenshot it’s a simple case but I could have N branches/objects and all their items could share their origin with another one so it must works for every branch.
As a result, i want two datatrees: one with only thes filtered items and one without.
I’m new to grasshopper and this forum, hope that someone will help me
thanks in advance,
best regards
split plane (10.6 KB)

3. Attach minimal versions of all the relevant files

P.S. ‘Shaded’ mode instead of ‘Wireframe’ will show the Z vectors of each plane, which can be helpful.

[edit: this definition is not working correctly. See later post]

I feel like there must be a couple of components that you just slide in the canvas and take care of the job… but I’m missing it, so in the meanwhile I came up whith this monster:

split plane (21.1 KB)

if you have more data with several branches to make some tests… because I have weird feelings if this will work with multiple branches, and also if you have some duplicate overlapping planes in the very same branch this will fail for sure :wink:

just a note: if in your whole definition that was not posted you have surfaces (or other geometries in general) to which these planes belong, for instance something like this:

I htink it might be much more easy to do the same task

1 Like

None of the planes in each branch have a common origin. There are two points that have two planes each, one from each branch, as you can see below. Two circles have both white and blue colors because they are in different branches. So what do you really mean?

I think he refers to cross-branch search

split plane (22.8 KB)

The text description is misdirection.

P.S. Same thing stripped of visual aids:

split plane datatree_2023_Aug13b
split plane (11.4 KB)

This is the same code with purple group added to copy and move planes, as a test of more than two branches. The first image below is a top view. As before, the duplicate planes are yellow.

split plane (26.6 KB)

Joseph I took the test-planes you are using in your definition :+1:

from what I have understood, Marco is looking for the planes that have same origin and also have opposite Z direction, and also could belong to different branches

this is my last approach (different from the previous one, that was not working correctly) but I believe there might be problems if more than 2 planes are placed on the very same location inside the same branch… I’m going to test this case later

split plane (22.4 KB)

In the cases cited so far, the Z direction is totally irrelevant, eh? Which is why I ignored it.

That possibility wasn’t present in the test data provided.

1 Like

split plane datatree (22.1 KB)
Hi Joseph,
thx for your efforts. the code you wrote works perfectly. Unfortunately in the next steps I need a Datatre with the same indexes number as the starting one. There must be two data trees, one with doubles with null value and one instead in which null are unique ones. Regarding the z directionts you are right, it’s irrelevant for the problem, i only realized it now. I’ll post the code with what’s upstream. Those points come out from surfaces. Maybe there’s a simpler solution, as Inno said. Sorry again for the confusion. Thanks

Hi inno,thx for ur effort. I made a reply to josheph, check it!

The only thing unfortunate about that is apparently you can’t do it on your own? The data trees from both green groups in my code match the original data tree structure. My experience is that very few people learn about data trees by having the work done for them. Good luck, I’m done here.