import bpy C = bpy.context mask = bpy.data.objects['Mask'] xmin = 100000000 xmax = -100000000 ymin = 100000000 ymax = -100000000 for v in mask.data.vertices: if v.co[0]xmax: xmax = v.co[0] if v.co[1]ymax: ymax = v.co[1] others = [o for o in bpy.data.objects if o != mask] print(xmin, xmax,ymin,ymax) for o in others: if o.type == "": for spline in o.data.splines: for p in spline.points: if p.co[0] < xmin: p.select = True elif p.co[0] > xmax: p.select = True elif p.co[1] < ymin: p.select = True elif p.co[1] > ymax: p.select = True if len(spline.points)==0: o.data.splines.remove(splines) C.scene.objects.active = o bpy.ops.object.editmode_toggle() bpy.ops.curve.delete(type='SELECTED') bpy.ops.object.editmode_toggle() elif o.type == "MESH": for v in o.data.vertices: if v.co[0] < xmin: v.select = True elif v.co[0] > xmax: v.select = True elif v.co[1] < ymin: v.select = True elif v.co[1] > ymax: v.select = True C.scene.objects.active = o bpy.ops.object.editmode_toggle() bpy.ops.mesh.delete(type="VERT") bpy.ops.object.editmode_toggle()