Hi.
You are just showing the 2D script, right? (I only see ADD2)
Remember that 2D script and 3D script are different things. You might get by with one REPEAT cycle in 2D, but in 3D you may need more to accomplish what you want. You may be missing some coordinate transformations to correctly position the panels in each iteration.
Other than that, is difficult to know how you want the object to work.
Best regards.