New, please help with cut

Hello, i am new to blender but, i managed to do a lot with it until i got truly stuck.

import bpy
import mathutils
import math
import bmesh

curx=0.0
cury=0.003
curz=1.1

dy=0.001
dz=0.01

planeIn=mathutils.Vector((curx, cury, curz-dz))
planeN=mathutils.Vector((0.0,0.0,1.0))

obj=bpy.context.edit_object
me= bmesh.from_edit_mesh(obj.data)
print (“start”)
zmax=-1000.0
zmin=1000.0

for li in me.edges:
if (li.is_valid):
p0=li.verts[0].co
p1=li.verts[1].co
if (p0.z<zmin):
zmin=p0.z
if (p1.z<zmin):
zmin=p1.z
if (p0.z>zmax):
zmax=p0.z
if (p1.z>zmax):
zmax=p1.z

    cross=mathutils.geometry.intersect_line_plane(p0, p1, planeIn, planeN)
    
    if ((p0!=cross) and (p1!=cross)):
        inside=mathutils.geometry.intersect_point_line(cross, p0, p1)
        if (inside[1]&gt;0 and inside[1]&lt;1):
            if (cross.y&lt;cury):
                newVert=bmesh.bisect_edges(me, li, 1, inside[1])
                print(cross, li.verts[0].index)

print(zmin, zmax)

bmesh.update_edit_mesh(me, True)

first problem i have for this is, that i do not want to do with the newVert.
and second, it generates an error on the line bmesh.update_edit_mesh(me, True) and i cannot understand why (i copy part of it from a template).

i will prefered to use other method but i NEED to cut by lines (not triangles).

so following questions.
what this does so far is the following, first, it gets the mesh, second it gets ever edge of it and check if it cross a plane, but even so only if the y vertex is above certain value (so a semiplane for real).

because of that i cannot use just the “cut plane” or it will cut beyound a point i may want to not cut.

questions here:

  1. Is there any way i can manage to use directly the "byp.obj.mesh.bisect?, because i have the plane and normal but, I do not understand the xstart, xend, ystart, yend, or cursor values.
    using this will be “FAR” more efficient. (because mostly will just change the object directly). but i cannot figure out how to calculate xstart and so, it makes no sense.

  2. if 1 is not possible, whats the best method and what do i need to do besides just “breaking” in the appropiate point?

i read a lot of options but most of them return the cut position and do nothing with the original edge.
in this case do i need to remove the entire face and create a replacement? please explain its terrible bad explained (or just not explained).

what it does so far is, a for next of every edge, gets the vertex, and checks if it should or not be cut (so that way at least it do this only to the ones i have and not to all).

i need to do this as fast as possible so i beg someone answers fast