I want to acces the SpaceView3D.relationship_lines that you can see in de right toolbar of the 3D view area. But I can’t seem to find a reference to the SpaceView3D object through Does anyone know where I can acces this so I can set the relationship_lines boolean on or off.


I did a bit of poking around and found where the relationship_lines property is added to the N panel. I altered it slightly so relationship_lines is always set to on (True).

So the properties looks to be at context.space_data.relationship_lines

You can assign directly to this ie:

context.space_data.relationship_lines = True
context.space_data.relationship_lines = False

And it looks as if you can test its state with if context.space_data.relationship_lines == True etc etc.

This will only work while you’re in the right context im guessing so, probably only works while drawing a menu which sets context to point to the right place.

I am really flaky when it comes to Blender Python so don’t take anything I say as being right :stuck_out_tongue:

Example code follows yanked from code the ships with blender and 1 line altered :

    def draw(self, context):
        layout = self.layout

        view = context.space_data
        gs = context.scene.game_data
        ob = context.object

        col = layout.column()
        col.prop(view, "display_render_override")

        col = layout.column()
        display_all = not view.display_render_override = display_all
        col.prop(view, "outline_selected")
        col.prop(view, "all_object_origins")
        col.prop(view, "relationship_lines")
        view.relationship_lines = True # MY ALTERATION HERE!!!!!!!
        if ob and ob.type == 'MESH':
            mesh =
            col.prop(mesh, "all_edges")

        col = layout.column() = display_all
        split = col.split(percentage=0.55)
        split.prop(view, "display_floor", text="Grid Floor")

        row = split.row(align=True)
        row.prop(view, "display_x_axis", text="X", toggle=True)
        row.prop(view, "display_y_axis", text="Y", toggle=True)
        row.prop(view, "display_z_axis", text="Z", toggle=True)

        sub = col.column(align=True) = (display_all and view.display_floor)
        sub.prop(view, "grid_lines", text="Lines")
        sub.prop(view, "grid_spacing", text="Spacing")
        sub.prop(view, "grid_subdivisions", text="Subdivisions")

        col = layout.column()
        col.prop(gs, "material_mode", text="")
        col.prop(view, "textured_solid")


        region = view.region_quadview

        layout.operator("screen.region_quadview", text="Toggle Quad View")

        if region:
            col = layout.column()
            col.prop(region, "lock_rotation")
            row = col.row()
            row.enabled = region.lock_rotation
            row.prop(region, "box_preview")
            row = col.row()
            row.enabled = region.lock_rotation and region.box_preview
            row.prop(region, "box_clip")

I tried it out, and it only works when drawing in the N-panel.

But the persons sitting next to me at work just found out how to do it.
when your 3Dview is visible on the screen, you can access it through bpy.context.screen.areas, one of the areas is the view_3D window, you can check this via bpy.context.screen.areas[0].type. When the type is ‘VIEW_3D’ you can acces the relationship_lines boolean through bpy.context.screen.areas[0].active_space.relationship_lines.
I made the following code to hide the relationship_lines:

def hideRelationshipLines():
    '''Function that hides the relationship lines if 3Dvieuw is visible in screen.'''
    areas = bpy.context.screen.areas
    for area in areas:
        if area.type == 'VIEW_3D':
            area.active_space.relationship_lines = False