# Palletizing grid: go to next colunm and reverse row

I would like to palletize as shown in the image below:

So when the tool is at the last item of the row, it doesnt start at the first item in the next row. Instead it continues its pattern at the same row location in the next column.

Is that possible with “Palletizing grid”? If so, how do I configure this?
Or do I need to achieve this in a different way?

Thank you!

This can be achieved by creating a new variable and mapping it to the counting variable the pallet routine is using for traversing. This mapping follows the order of odd-numbered rows and reverses the order of even-numbered rows, as desired. It is based on the row and the position within the row for the value of this new variable. Any further explanation of how this mapping is derived is omitted for brevity, but I can provide details if there is sufficient interest.

Suppose that cnt_1 is the variable the pallet routine is using for traversing, and create a new variable var_1. Let k be the number of positions in a row, and let N be the total number of positions in the pallet. For example, we would have k=3 and N=12 for the diagram in the original post. The mapping is done piecewise based on row parity with an If/Else statement. After the pallet routine, the new variable is incremented with an If/Else statement, where the details of the Else depend on desired behavior when var_1=N.

Program
BeforeStart
var_1≔1
Robot Program
If ceil(var_1/k)%2≟1
cnt_1≔var_1-1
Else
cnt_1≔2kceil(var_1/k)-var_1-k
Pallet
Pattern: Square
Corner1_1
Corner2_1
Corner3_1
Corner4_1
PalletSequence
Approach_1
PatternPoint_1
Exit_1
If var_1<N
var_1≔var_1+1
Else
Halt