Is there a quick way to snap the Origin to 3D Cursor with a script?
Currently I select an element in edit mode, snap 3D Cursor to Selected, go into Object Mode and set Origin to 3D Cursor.
I copied this process from the Info window and pasted it into a text as:
import bpy
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.editmode_toggle()
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
but get an error in the console window:
File "/Applications/blender.app/Contents/Resources/2.79/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_selected.poll() failed, context is incorrect
Error: Python script fail, look in the console for now...
Using Blender 2.79