I am getting an error when trying to center the cursor in a python script
import bpy
bpy.ops.import_scene.obj(filepath=objFilePath, axis_up='Y')
bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
view3d = bpy.context.screen.areas['VIEW_3D'].spaces[0];
view3d.pivot_point = 'CURSOR'
view3d.cursor_location = (0.0,0.0,0.0)
USER = os.environ['USER'];
bpy.ops.export_scene.fbx(filepath="/Users/"+USER+"/house.fbx", path_mode='RELATIVE', object_types={'MESH'})
Error:
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/private/var/folders/48/ptx7wqz138x4_shgs5nk6szm0000gn/T/AppTranslocation/DEB386B3-C3FC-4FAB-B7A2-0954C07B91CF/d/blender.app/Contents/MacOS/../Resources/2.78/scripts/modules/bpy/ops.py", line 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.view3d.snap_cursor_to_center.poll() failed, context is incorrect
I am trying to center the origin of my model in batch mode of blender.