When a new install of Blender opens, there is a camera, a light source, a cube and a matrix of vectors on the x,y 16x16 plane.

As I do not know what this is called, I cannot search for it to switch it off or change its values. I've checked Neal Hirsig's grand reference, and gone through the User Preferences, but cannot find what I'm looking for.

What is this reference vector matrix called? How can I modify it? I want to toggle it into/out from my 3D ViewPort Editor Window.

EDIT: OK we know it is now called the grid floor, but I need to toggle it programmatically and didn't ask for that at first.

bpy.types.SpaceView3D.show_floor = False

does not appear to work in code.


2 Answers 2


To show or hide the grid floor you must first find the 3D view space, then use the space's show_floor porperty:

import bpy

def find_3dview_space():
    # Find 3D_View window and its scren space
    area = None
    for a in bpy.data.window_managers[0].windows[0].screen.areas:
        if a.type == 'VIEW_3D':
            area = a

    if area:
        space = area.spaces[0]
        space = bpy.context.space_data

    return space

space = find_3dview_space()
space.show_floor = False

What you tried to do is to access the SpaceView3D type, which is the class of the 3D view space object. You cannot access methods directly from the class, but rather need to find the object instantiating that class as specified above.


In Blender we can view multiple 3d view-ports simultaneously. Some operations, like setting the grid to visible using 'show_floor', are unique per viewport. The result is that there's no single command you can trigger to disable the grid in all views. You can however make a small function to do exactly that.

@TLousky already gives most of the answer, but if you see it in another form you might get a better picture.

import bpy

def set_show_floor(visibility=True):

    for a in bpy.data.window_managers[0].windows[0].screen.areas:
        if a.type == 'VIEW_3D':
            for space in a.spaces:
                if space.type == 'VIEW_3D':
                    space.show_floor = visibility

''' show floor '''
#   set_show_floor()  # defaults to True anyway
#   set_show_floor(True)

''' don't show floor '''
#   set_show_floor(visibility=False)

or iterate through them using this:

for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:
        if area.type == 'VIEW_3D':

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .