Deleting mesh objects

Sorry for this question which must have been asked a million times- I can’t seem to find my situation answered.

I created a script which produces a long list of vertices (>1000). In the next step, I would like to run through this list, connecting three vertices at a time to make a face. As this object “grows”, I want to capture it growing in the 3d viewport by automatically moving to the next keyframe. However, my half-baked solution produces as many mesh objects as there are number of terms in the original list. How do I delete the mesh objects from the previous keyframes in the current keyframe? Thanks in advance!


poly = NMesh.GetRaw()


addFrames = 10
# Set current frame to 1
Blender.Set(“curframe”, 1)
currentFrame = 1

    for i in range(1, numofterms-5):
        f = NMesh.Face()
    polyObj = NMesh.PutRaw(poly)

Go to the next keyframe

      currentFrame = currentFrame + addFrames
      Blender.Set("curframe", currentFrame)
       # Redraw the 3D view

p.s. It looks great when I run it, but of course it slows down tremendously with the number of terms.

unfortunately you can not. Blender keeps all created data around even if deleted(till the scene is reloaded).
your best bet is to do somthing like mesh.verts = [] before constructing the new mesh/frame.