# Center 3D cursor with script

I am trying to set the 3D cursor to the center using a script, so that when it then imports an FBX it is based on that cursor location.

So far I have this:

import bpy

for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
bpy.ops.view3d.view_all(center=True)


But I get an error: Operator bpy.ops.view3d.view_all.poll() expected a view3d region

If there is a better way to set the 3D cursor then that would be nice. But if this is the best way, then can anybody help me mend my script?

• – batFINGER May 22 '19 at 5:46
• Excellent. This works then: bpy.context.scene.cursor.location = 0,0,0 – edna May 22 '19 at 6:05