Locating Areas by Grid Intersections


First post, fairly new to Dynamo so I’ll do my best to speak intelligently. I have a large architectural Area Plan with hundreds of grid intersections. My goal is to identify the closest grid intersection to each Area centroid, and write that grid intersection back to the Area itself within Revit. To complicate matters, I’ve been asked to always specify the intersection at the bottom left of the four intersection zone, even if the other three intersections are closer (see below for clarification).

I began by attempting to find the closest intersection by finding the xyz coordinates of both the areas and the grid intersections as it seemed easier, but have still hit a wall. I used the Geometry.DistanceTo node with Cross Lacing to show all possible distances between all points, then sorted this to find the smallest values.

All that being said:

  1. How do I pair the smallest distance values with the points they correspond with?
  2. Can I adapt this approach to find not only the closest, but the closest “bottom-left” intersection?
  3. How can I determine the grid intersection value (Grid Name parameter for two grids) at the specified point?

For Bonus Points
Is there a better way to specify all grid intersections? I found this code block online and it only picks up grid intersections between Numbered and Lettered Grids (numbers and numbers / letters and letters intersections don’t report).

Thanks in advance for any insight you might be able to lend!