Slicing an object into parts along axes other than x, y, z with a python script
Alignment object.

Have made a small modification to my answer to linked question, to instead of using the objects bounding box, use the global bounding box of the object named &quot;Cube&quot;.
Above shows a test run on default cone. The active object gets sliced. It uses the object named &quot;Cube&quot; as axes.
This could all be done via script by realigning and calculating the bbox given the chosen slicing axis.
import bpy
from mathutils import Matrix, Vector
context = bpy.context
ob = context.object
scene = context.scene
axis_ob = scene.objects.get(&quot;Cube&quot;)

size = 4 * max(axis_ob.dimensions)
mw = axis_ob.matrix_world

def bbox(ob, matrix=Matrix()):
    return (matrix @ Vector(b) for b in ob.bound_box)

def bbox_center(ob, matrix=Matrix()):
    return sum(bbox(ob, matrix), Vector()) / 8

def bbox_axes(ob, matrix=Matrix()):
    bb = list(bbox(ob, matrix))
    return tuple(bb[i] for i in (0, 4, 3, 1))

        

bpy.ops.mesh.primitive_plane_add(
        location=bbox_center(axis_ob, axis_ob.matrix_world),
        size=size)
chopper = context.object
m = chopper.modifiers.new(&quot;Sol&quot;, type='SOLIDIFY')
m.thickness = size


chopper.select_set(False)

def chop(ob, start, end, segments):
    slices = []
    planes = [(f, start.lerp(end, f / segments)) 
            for f in   range(1, segments)]

    for i, p in planes:
        m.thickness = -size
        bm = ob.modifiers.new(&quot;BOOL&quot;,type=&quot;BOOLEAN&quot;)
        bm.object = chopper
        bm.operation = 'DIFFERENCE'
        M = (mw @ end - mw @ start).to_track_quat('Z', 'X').to_matrix().to_4x4()
        M.translation = mw @ p

        chopper.matrix_world = M
        cp = ob.copy()
        cp.data = cp.data.copy()
        context.scene.collection.objects.link(cp)
        bpy.ops.object.modifier_apply({&quot;object&quot; : cp}, modifier=&quot;BOOL&quot;)
        slices.append(cp)
        m.thickness = size
        bpy.ops.object.modifier_apply(
                {&quot;object&quot; : ob}, modifier = 'BOOL')
    slices.append(ob)
    return slices

segments_x = 1
segments_y = 1
segments_z = 8

# change the cutting box
block = context.scene.objects.get(&quot;Block&quot;)

o, x, y, z = bbox_axes(axis_ob, mw.inverted() @ axis_ob.matrix_world)
for ox in chop(ob, o, x, segments_x):
    for oy in chop(ox, o, y, segments_y):
        chop(oy, o, z, segments_z)

bpy.data.objects.remove(chopper)