Beem and wall distance from Grid

I’ve serched for houres on the web and on this forum for a solution on how to get the shortest distance from beem or wall to grid. I Found a post from Einar Raknes that finds wich grid that is nearest, but dosen’t wright the distance, only wich axis. When I add these nodes for distance, the values are wrong (se picture) Is there someone who has the solution for this?

Best regards

Could you share your Dynamo and Revit files on the Forum? (or a sample) because it is really hard to see the problem now


I’ve managed to solve the problem with a lot of help form @L.Maas. My problem was that I got the 3D distance insted of the 2D distance. I’ve linked my solution here :slight_smile:Avstand mellom bjelker og akser.dyn (60.6 KB)

As far as I can see from the image, it is a lacing problem: you are getting the distance from the element with a grid, not with all grids, as the following pattern
element A -> grid 1
element B -> grid 2
element C -> grid 3
(the result is A1, B2, C3)
To achieve the shortest (or largest) distance from grids, you have to check the element witll all of them and, later, taking the min (or max) value:
element A, grid 1,2,3
element B, grid 1,2,3
element C, grid 1,2,3
(the result is A1, A2, A3, B1, B2, B3, C1, C2, C3)
look for the cross product lacing on primer to have a reference.

Here’s my file for your study
ShortestDistanceToElement.dyn (44.3 KB)

Thank you :slight_smile:
I will try this