Auto dimensions between columns and closest grid

Hello Everyone,
In script of placing dimensions between columns and closest grids and due to using get location method the dimensions are placed between the grid and the mid point of columns ,
How could I modefy this script to make dimensions between grids and the the nearest face of the column ?

In the script you must pick the face of the column as reference instead of placing point of the column. Use the search function of the forum, there are several threads that can guide you.