I have a set of points and I want to identify which ones are closest to a group of surfaces in order to assign them the surfaces’ layer names.
On one hand, I have a point data tree structured as {A;B;C}, where A ranges from 0 to 4. On the other hand, I have a tree {X} (also from 0 to 4) containing six surfaces per branch.
My goal is to calculate the distance between the points in branch 0 and the surfaces in branch 0, branch 1 with branch 1, and so on. I need to find which surface is closest to each point, sort them, and assign the corresponding layer. However, I’m having trouble with the ‘Sort List’ component…
Could you please help me with this? Thanks in advance Forum11.gh (161.7 KB)
a problem in the input / output of surface closest point.
the input is grafted 30 <> 71.
The output of the bottom parts is 30 per component.
So you have to order the data tree in a way, that there are equal numbers on all the inputs of the sort list.
This can be done, by first flattening the surfaces and then graft them. That way you go from 5 branches of 6 to 30 branches of 1
Next flatten the inputs on the points, otherwise you get 30 x 71 = many braches.
Next flip the matrix to go from 71 x 30 to 30 x 70
The components in the bottom all give NULL output, so no results yet.
Thank you all very much for your help, and I apologize for not uploading the .rh file sooner. I have tried to simplify the problem: first, with 21 points and one surface… it works that way. However, I have tried it with 21 points and six surfaces and I can’t get it to work; I think I am mishandling the ‘Duplicate Data’ component. This time I am attaching both the .gh and .rh files." Forum11_v1.gh (18.8 KB) Forum11_v1.3dm (123.3 KB)
Thanks so much @leopoldomonzani.I apologize for the delay in replying; unfortunately, I don’t always get to decide my own work priorities. You’re right, that is the general idea, but it seems there are two points where two layers are overlapping. I’m going to look into it and find the reason why.
Regards
Thank you very much for your help and patience @Dfytz1. Your solution works and it’s very elegant. I don’t quite understand the “Tree Branch” step, because the number of branches coming into the “Tree” input is different from the number of “Paths”, yet the cluster doesn’t return an error. I’m going to review it to see if I can figure it out. I’m going to wait and keep testing it before marking it as solved.
I have reviewed the definition and I understand how it works (I’m adding some notes in case they help anyone else). However, when I apply it to multiple groups of surfaces, the Tree Branch component fails and I’m not sure why.
My goal is not just to make it work, but to ensure it works correctly up to the Match Tree output. I suspect it’s a Data Tree structure issue. Could you please help me with this?
Yes it is pull point component again. Use it already. If you are using rhino 7, you can use curve nearest object instead. Just create small lines from your points.