Hello I'm quite new in this api. I want to use knife_tool from bpy.ops.mesh on the selected face. When I just call (like in tooltip):


I get error:

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/t/blender-2.71-linux-glibc211-x86_64/2.71/scripts/modules/bpy/ops.py", line 188, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.mesh.knife_tool.poll() failed, context is incorrect

I tried in edit and object mode. Maybe is any other way to cut face in my own points from console?


The knife tool is an interactive process that relies on the location of the mouse cursor and button clicks to perform it's task. This interactivity would make it hard to control from a python script.

To automatically edit a mesh through python you want to look at the bmesh module which is the underlying foundation to all mesh editing operations.

The issue with incorrect context indicates that the operator only works while the 3dview is active.


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.