 # How can i find minimum distance between two holes in a cube?

like the above figure i need to find minimum distance between the holes, how to find that?

In case if your cylinders are not extruded verticaly, you can slice them into severals sections and calculate the nearest distances between each two corresponding cross sections and take the minumum distance from distances list.

Minimum distances.gh (23.1 KB)

2 Likes

Thanks a lot, does it work for multiple holes? Like around 10?

I think the method I proposed is not giving you the right answer for all cases.

.

So basically the method I proposed will calculate the distance between curves at each cross-section of objects ( such as d1,d2, and d4). But it fails to calculate distances such as d3 which can be smaller than d4.
So it’s better to simplify the question of how to calculate the minimum distance between two or several objects?
I’m also interested to know if anyone has a clue.

1 Like

as you can see, i used the same process as you , its only being able to measure distance between 2 holes. i want to measure distance between these 2 holes and 3rd hole. how to do this?

min dis.gh (12.9 KB) this my my file, please do tell me

sir do you have a way?

Hi again. as I said your problem can not be solved by the method of comparing distances of several geometries from a curve. I have made a rudimentary code that can tell you whats the minimum distance between sets of surfaces. For now, it does not tell you where the point is. it’s just telling you the value. if you increase the r-value it gives you a more precise number as result(for sure it will be slower if you increase the r).

[Minimum distances.gh|attachment]Minimum distance between sets of surfaces.gh (4.8 KB)

i am focusing on straight cylinders, and the number of cylinders may vary. it should the distance between all the cylinders taken 2 at a time. how should i do this

you can put as many as cylinders you want in the input. it will tell you the minimum distance. Just make sure your cylinders are surfaces(Not Brep).

1 Like

in this figure i.m not able to contour the third cylinder too is it not possible?

Please take a close look at what I sent you. it works with surfaces.

1 Like

its actually top view of a solid. i tried again but, i’m not able to contour the 3rd cylinder

Ok I modified the file a bit. This new file can also tell you from which point the closes distance is happening.

1 Like
3 Likes

is it possible to modify this for 3d solids?

I believe this is a complicated question. There must be a mathematical approach such as Line geometry … to this problem.

@DavidRutten can we compute the minimum distance between sets of any kind of geometries?

1 Like