yeah no problem

let’s take a sample “layer” where all the points have the very same Z height, like the following:

I have set the number of columns to 3, and the multiplier slider to 5, so you get one list of “inside points”, one per column: 0, 1, 2 ; and another list of “outside points”, m times number_of_columns, in thise case 5 x 3 = 15 points numbered 0 to 14

because the inside circle (where column points are created) and the outside circle are an offset of each other, then we know that both the curves have same direction and have a “congruent” seam, which means they also have the same “starting point” (and believe me, this is a big thing )

because I have set m to 5, it means that I have 5 steps in between each column

so the very first 5 steps will all have start_column = 0 and end_column = 1, the only thing that changes is the external point they traverse

like:

1st step → column_0, external_0, column_1

2nd step → column_0, external_1, column_1

3st step → column_0, external_2, column_1

4st step → column_0, external_3, column_1

5st step → column_0, external_4, column_1

represented all together they look like this:

after the first m (set to 5) steps, you have to swap columns, so the first column will be 1, and the second column will be 2:

6st step → column_1, external_5, column_2

7nd step → column_1, external_6, column_2

8st step → column_1, external_7, column_2

9st step → column_1, external_8, column_2

10st step → column_1, external_9, column_2

probably you see the pattern now

assuming you have n columns, m multiplier and s steps, it will move like this m times

column_n, step s, column n+1

column_n, step s+1, column n+1

column_n, step s+2, column n+1

column_n, step s+3, column n+1

column_n, step s+4, column n+1

then after m repetitions you add +1 to both columns, which become:

column_n+1, step s+5, column n+2

column_n+1, step s+6, column n+2

column_n+1, step s+7, column n+2

column_n+1, step s+8, column n+2

column_n+1, step s+9, column n+2

and so on:

column_n+2, step s+10, column n+3

column_n+2, step s+11, column n+3

column_n+2, step s+12, column n+3

column_n+2, step s+13, column n+3

column_n+2, step s+14, column n+3

so the bottom part of the script is just generating the very same indexes to recall those very same items on different layers:

[edit] now that we know how the steps should zig-zag on the two lists of points, we need to know how many steps we have in total, and can take that info from here, which is total height [integer_division] step height:

and finally, because points are already organized in branches starting from min_Z to max_Z, for each step (for each branch) we take an iteration, meaning each branch contains a step, and the next branch contains the next step