In this tutorial I will show you a source code in python that allows the selection of vertices by a coordinate, and separates this selection into a new object according to the faces.
The source code is presented below and is commented on accordingly to understand how it works.
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.subdivide(number_cuts=3)
bpy.ops.object.mode_set(mode="OBJECT")
# add this source code
bpy.ops.object.mode_set(mode = 'EDIT')
# need to use bmesh
import bmesh
# select the plane and get data mesh
plane_obj = bpy.data.objects['Plane-Y+Z']
plane_mesh = plane_obj.data
bm = bmesh.from_edit_mesh(plane_mesh)
# select vertices by points
for v in bm.verts:
v.select_set(v.co.y < 0.5)
#get mode
bm.select_mode = {'VERT', 'EDGE', 'FACE'}
# this will update the selection
bm.select_flush_mode()
# select by FACE
bpy.context.tool_settings.mesh_select_mode = (False, False, True)
# separate selection by face
bpy.ops.mesh.separate(type='SELECTED')
# select by EDGE
bpy.context.tool_settings.mesh_select_mode = (True, False, False)
# define the new camera named NewCamera