deleting a face on mesh ?

i can list faces with this
jj=0
faceno=0

for f in myMesh.faces:

  print ('Face s No =',faceno,' f=',f)
  if faceno==5:
       print ('face to be remove=',f)
   faceno+=1

but then what command can i use to delete one of the face ?

Thanks

Here its a way to delete faces.


import bpy

print("--------")

obj = bpy.context.object

for f in obj.data.faces:
    
    #deselect all faces
    f.select = False
    
    #condition to remove face
    if f.index==4:
        f.select = True

if bpy.context.mode == 'OBJECT':
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.delete(type='FACE')
    bpy.ops.object.editmode_toggle()

ok nice way with operators
but i was more interested in the Bpy. type way of doing thing
any idea how it can be done that way ?

folllowing the little example i has given
we can see all the faces but then

is there an equivalent to select the face then erase it in Bpy.type

thanks happy 2.5

Using the bpy its far more complex.

You will have to reproduce the mesh, i mean:
In order to create a face u have to assign at least 3 vertices indexes to faces.vertices collection.
reassigning these indexes to vertices that doesnt exists could work but doesnt remove the face.
obj.data.faces[0].vertices[0]=200
obj.data.faces[0].vertices[1]=201
obj.data.faces[0].vertices[2]=202

Another way its reproducing and replacing the mesh:
In order to do this you will have to get all the vertex information:
Something like
verts = []
for vx in obj.data.vetices:
verts.append(vx.co)

then reproduce the faces information:
faces = []
for face in obj.data.faces:
f = []
if face.select==False:
for i in range(0, len(face.vertices)):
faces.append(f)

me = bpy.data.meshes.new(obj.name)
me.from_pydata(verts, [], faces)
obj.data = me

wait i dont really want to create a new face on an existing mesh
mind you might be interesting to know how to also

but i simply want like adding a cube mesh
then remove the bottom face so i get an open box

so there are no simple way to remove one face with bpy.type command

only simple way is to use bpy.ops!

thanks