Closest Points to given point

Hi All ,

Can anyone here help me to get closest points to given point ?

I have 85 points & 1100 point lists

I want to check 85 times against 1100 to get all closest points to given point.

I have used “Close Point” but not getting desired results

Thanks in advance

Regards

Where’s your code?

You have it set-up correctly already, what’s the problem you’re having?

Hi @Artstep Thanks for your time.

Problem i have is that i require “Closest Points” to 85 is separate lists i only get closest point.

there is like from 2 to 50 points close to each of 85 points and i wat to identify them

Regards

Did you look at the screenshot? It shows how to generate 85 lists where each one contains the closest point?

Thanks for your time again.

Yes i did had a look and it appears that it only gives closest “Point” not Points.

As there is more than one point closest to 85 given per each list

Regards

Oh I see, well then use ClosestPoints instead of ClosestPoint - you can specify how many you need

that’s the problem here that its not the same amount on each point. Without checking first i cant define numbers.

Is this even possible what im trying to do here ?

Thanks

It would be easier to help if you upload your .gh (with data internalised)

It’s like pulling teeth…. why couldn’t you just write what you needed in the first post? Maybe a diagram? A file?

You can measure the distance between the 85 and 1100 and CullPattern when the Distance is SmallerThan the required amount

Hi Please see attached.

This is what im after

poistclosesttopoint.gh (41.2 KB)

Awesome, this makes your issue very easy to fix

poistclosesttopoint.gh (42.1 KB)

Thanks @Artstep ,

Its almost there but not quiet yet.

Some points going to wrong locations is there a way to fix it ?

Regards

That’s related to something happening upstream in the script - your box centers are irregular, which creates inconsistencies when looking for the closest point - you need to make the box centers more regular first - So B will be “wrong” because A should be in line with B

Thanks Again @Artstep ,

Is there a better way of doing this boxes never the same.

Can we check to box instead of point ?

Regards

I don’t know your project well enough to advise - maybe? You could create a grid yourself, you could adjust the center point locations, you can break it down in multiple boxes and check the distances to a “group” of centers - checking to the box doesn’t really help when the boxes are irregular and overlapping, you still have to make them make sense.

Hi @Artstep thanks for your time gain .

What do you mean by “Group”? All im after is collect closest points to each box. or point. Problem is these boxes will newer be the same hence i want a method that works on given box or point.

Boxes should not overlap here , do i have them overlapping?

Sorry been spinning on this for a weeks now probably overlooked something

Regards

I have been wondering about doing something like this:

Generate a number of points per surface and then sample the distance to them - then either with MassAddition or Average, you could find which “group” the points are closer to - but I don’t know, I doubt I’ll get round to Rhino today, so I can’t test - the boxes are not only overlapping, there’s a massive one that goes through almost all of the others - you could try with a BrepClosestPoint or even a mesh - the logic I gave you was mainly focusing on sorting things into branches based on distance to an object, how you generate that distance is up to you - I would be looking to redraw the grid so that the spacing is even

what about Pull Point to the boxes and sort by distance?

Hi thanks again for your time.

But i think you have resolved problem / guided me to solution by saying “Boxes Overlapping”.

I went back and checked all boxes and have found an issue. Once i get to the bottom of this ill post you an update

Regards