1
$\begingroup$

The python tooltip says to use

bpy.data.screens["Scripting"].overlay.grid_scale = n

but that doesn't work. There are no other commands that execute when I do it manually. So it's just that command. Except when I do it programmatically it doesn't work (AttributeError: 'Screen' object has no attribute 'overlay'). This pictures sums up the problem.

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$

The error message is trying to inform you that the property lookup <screen>.overlay was unsuccessful, because that's not where that property is located (the tooltip is misleading..) . It's something you might want to iterate through screen area.spaces to locate and set. It's a little awkward, but acceptable.

import bpy

AREA = 'VIEW_3D'

for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:
        if not area.type == AREA:
            continue

        for s in area.spaces:
            if s.type == AREA:
                s.overlay.grid_scale = 2
                break

or..

import bpy
for area in bpy.data.screens["Scripting"].areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                space.overlay.grid_scale = 2
                break
$\endgroup$
1
  • $\begingroup$ NICE! Thank you. $\endgroup$
    – user875234
    Commented Oct 6, 2019 at 17:04

You must log in to answer this question.

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