I'm trying to divide a mesh into multiple parts along the z axis. I've followed another tutorial and managed this, which divides the mesh into 2 parts, but I can't seem to divide it into more than two. Quite new to blender scripting so I'm not sure how to fix this. Any help would be appreciated, but the solution does need to be a script. The code I'm using at the moment is below.
import bpy, bmesh from bpy import context as C bpy.ops.object.mode_set(mode='EDIT') bm = bmesh.from_edit_mesh(C.object.data) edges =  for i in range(-10, 10, 2): ret = bmesh.ops.bisect_plane(bm, geom=bm.verts[:]+bm.edges[:]+bm.faces[:], plane_co=(0,0,i), plane_no=(0,0,1)) bmesh.ops.split_edges(bm, edges=[e for e in ret['geom_cut'] if isinstance(e, bmesh.types.BMEdge)]) bmesh.update_edit_mesh(C.object.data) bpy.ops.mesh.separate(type='LOOSE') bpy.ops.object.mode_set(mode='OBJECT')