I have an object that I want to split into 3 segments and save into individual obj files. The object is placed in the center and the x-y plane. I want to cut them along the y-axis. I have attached a sample image from free3d for visualization. The main object file is at the center and the 3 split obj files are shown below the main one. I have tried using bisect in Python script but obviously that only splits the file into two parts. Is there a way to split them into three and save them individually? The Python script I have tried is given here:
import bpy
import os
import mathutils
input_path = "skull.obj"
output_path = os.path.join(os.path.dirname(input_path), "cut.obj")
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
bpy.ops.import_scene.obj(filepath=input_path)
obj = bpy.context.selected_objects[0]
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bbox_min = min([mathutils.Vector(v) for v in obj.bound_box])
bbox_max = max([mathutils.Vector(v) for v in obj.bound_box])
length_y = bbox_max.y - bbox_min.y
cut_min_y = bbox_min.y + 0.25 * length_y
cut_max_y = bbox_max.y - 0.25 * length_y
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.bisect(plane_co=(0, cut_min_y, 0), plane_no=(0, 1, 0), clear_inner=True)
bpy.ops.mesh.bisect(plane_co=(0, cut_max_y, 0), plane_no=(0, -1, 0), clear_outer=True)
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.export_scene.obj(filepath=output_path, use_selection=True)
print(f"File saved as: {output_path}")