Dimension in tag from closest Grids

Hello -

At Grids1.dyn (36.7 KB)

Looking to speed this up / make more efficient. It reads distance to from grid to category and populates a shared parameter to tag (Tested with light fixture and structural column) Any help would be appreciated.


  • Jason

I would look to:

  1. Get the coordinates of the grids in Y and X (this could even be relative to an auxiliary coordinate system if your building is rotated)
  2. Get the location of the tags
  3. Round the tag location X and Y coordinates to the nearest grid dimension (round to the nearest n-spacing)
  4. Create two dictionaries of grids for those orientated in the X and Y axes, and use their n-spacing as the keys
  5. Use the result from 3 to access the dictionary and return the nearest grids

This would eliminate all the processes which are slowing your graph:

  1. No need to extract the curves from the grids
  2. No need to perform expensive geometry intersections
  3. No need to compute distance to, to establish proximity

Thanks, I’ll let you know what I come up with!

Update on this, I struggled with getting the coordinates of the grids and the math calcs so I asked for help in the office and here is his result, no library of grid spacing, instead simple math calculations to determine which grid line each lighting fixture center point is closest to.


Edit: Forgot to mention this only works for horizontal and vertical grids.

Heej Jason

Can you share the dynamo file. I’m intresting in the script to learn from it


Hi @mve,

Here’s another example link
Maybe it can be of help.

Kind regards,