I'm trying to override the context, in order to run this Delaunay Triangulation add-on. I'm using the approach suggested in this answer:
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
override = bpy.context.copy()
override['area'] = area
bpy.ops.delaunay.triangulation(override)
break
However the add-on still fails when it tries to create a mesh, due to incorrect context:
Error: Traceback (most recent call last):
File "/Applications/Blender/blender.app/Contents/Resources/2.74/scripts/addons/delaunay_voronoi/delaunayVoronoiBlender.py", line 97, in execute
bpy.ops.view3d.snap_cursor_to_selected()#move 3d-cursor
File "/Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/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
The same error message appears four or five times, but always relating to line 97 of the add-on's script (bpy.ops.view3d.snap_cursor_to_selected()
).
Am I overriding the context correctly? Is there anything else I could try?