Access Grid of 3D View with Python
PY console code

Each 3d view space has a setting for grid lines and grid scale (as well as grid subdivisions) See 3D View &gt; Properties (N) &gt; Display

For example sake I have set the lines to 4 and the scale to 0.5.

Py console test code, first find the 3d view area.

&gt;&gt;&gt; for i, a in enumerate(C.screen.areas):
...     i, a.type
...     
(0, 'INFO')
(1, 'PROPERTIES')
(2, 'CONSOLE')
(3, 'VIEW_3D')
(4, 'TEXT_EDITOR')

&gt;&gt;&gt; space = C.screen.areas[3].spaces.active


Get the settings

&gt;&gt;&gt; space.grid_lines
4

&gt;&gt;&gt; space.grid_scale
0.5


Set up our range (for example -2 to 2) Notice I use integer modulus j // 2 (since odd numbers give the result of prior even number)

&gt;&gt;&gt; g = space.grid_lines // 2
&gt;&gt;&gt; rge = range(-g, g + 1)


Iterate over x and y to give the 2D vec of XY grid. The scaling of 0.5 makes the point (2, 2) => (1, 1)  (_ ... are results edited out for brevity)

&gt;&gt;&gt; for x in rge:
...     for y in rge:
...         space.grid_scale * Vector((x, y))
...         
Vector((-1.0, -1.0))
Vector((-1.0, -0.5))
Vector((-1.0, 0.0))
Vector((-1.0, 0.5))
    ...
Vector((0.0, -1.0))
Vector((0.0, -0.5))
Vector((0.0, 0.0)) # origin
Vector((0.0, 0.5))
    ...
Vector((1.0, 1.0))

&gt;&gt;&gt;