bp4520-how to delete a face
====================================
import bpy
import bmesh
print("--------")
#----- MUST BE IN OBJECT MODE - OBJECT SELEED
obj = bpy.context.object
sm = bpy.context.tool_settings.mesh_select_mode
sm = [False,False,True]
#----- MUST BE IN EDIT MODE
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.editmode_toggle()
#----- MUST BE IN OBJECT MODE
for f in obj.data.polygons:
#condition to remove face
if f.index < 4:
f.select = True
print('-------true---------')
sm = [False,False,True]
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.delete(type='FACE')
#bpy.ops.object.editmode_toggle()