I'm trying to delete, as in This Example, but Faces instead of vertices along a particular axis. So, as an example (see image) this cube's face that I have selected would need to be deleted along the x axis using python. From the above link (following mostly the 3rd answer), I don't understand how they're setting which axis to delete by, or how to do the operation for faces.
My code is is different, because my needs are different than the example. It doesn't throw an error, it just doesn't do anything
def _debug(vert):
n_selected = len([v for v in vert if v.select])
n_deselect = len([v for v in vert if not v.select])
print('\nlen vertices = {}, {} selected, {} not selected'.format(
len(vert), n_selected, n_deselect))
x_thresh=0.0
vert = bpy.context.object.data.vertices
_debug(vert)
for v in vert:
if v.co[2] < x_thresh:
v.select = True
_debug(vert)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.delete(type='VERT')
bpy.ops.object.mode_set(mode='OBJECT')