1
$\begingroup$

I am trying to store the grid scale, but keep getting an error for being in the text editor view.

I have tried

bpy.context.area.type = "VIEW_3D"
print(bpy.context.space_data.grid_scale)

but am getting an attribute error for "SpaceTextEditor" not having a "grid_scale". However, the space does change to the 3d view, so the first line is going through.

Any help is appreciated.

$\endgroup$
2
$\begingroup$

Your code works for me in 2.69, but there might be timing issues (grid_scale accessed but the view has not finished changing).

To get all 3D Views' grid_scale as a list, use:

grid_scales = [area.spaces[0].grid_scale for area in bpy.context.screen.areas if area.type == 'VIEW_3D']
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.