I used the ‘bpy.ops.mesh.knife_project()’ in blender python ,but it prompt me
Python: Traceback (most recent call last):
File “\文本”, line 64, in
File “K:\DevGit\blender-4.0.2-windows-x64\4.0\scripts\modules\bpy\ops.py”, line 109, in call
ret = _op_call(self.idname_py(), kw)
RuntimeError: Operator bpy.ops.mesh.knife_project.poll() 期望一个 3D 视图区域和编辑网格
and how to do to solve it?
Attached is my Python script code
bpy.ops.object.mode_set(mode=‘EDIT’)
bpy.ops.mesh.select_all(action=‘SELECT’)
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
space = area.spaces.active
space.region_3d.view_perspective = ‘ORTHO’
space.region_3d.view_rotation = (1.0, 0.0, 0.0, 0.0)
area.tag_redraw()
scene.tool_settings.mesh_select_mode[1] = True
bpy.ops.mesh.knife_project()