# Moving towers of pieces

Options
Good morning, I would like you to help me resolve a question I have. I want to move a tower of pieces to a destination point and place these pieces at a given distance from the point as equitable as possible (see image Resultado). For this I have 3 points created: the first (pReposo) is the starting point and end of movements of the robot, the second point (pBaseOrigen) which is the base point where the tower of pieces is, and the third point (pCentroDestino) which is the center of the destination where you want to leave the pieces. In my RAPID code I have 4 variables that are: altoPieza (height of the piece), nPiezasTorreOrigen (number of pieces that the tower has origin), nTorresDestino (number of towers that you want around the point pCentroDestino) and radioCircunf (radius of the circumference destination). My RAPID code is the following:

MODULE Module1
CONST robtarget pBaseOrigen:=[[1500,-500,750],[0,0,1,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget pCentroDestino:=[[1700,1000,750],[0,0,1,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget pReposo:=[[1808.910161514,0,1855],[0.5,0,0.866025404,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

VAR num altoPieza := 50;
VAR num nPiezasTorreOrigen := 10;
VAR num nTorresDestino := 3;

PROC main()

FOR i FROM 1 TO nPiezasTorreOrigen DO

MoveL Offs(pBaseOrigen, 0, 0, altoPieza*nPiezasTorreOrigen - (altoPieza * (i - 1))), v800, fine, Ventosa\WObj:=wobj0;
SetDO SD_ActivaVentosa, 1;
WaitDI ED_PiezaCogida, 1;
MoveL pReposo, v500, z100, Ventosa\WObj:=wobj0;

FOR j FROM 1 TO nTorresDestino DO
MoveL Offs(pCentroDestino, 0, 0, altoPieza * i), v500, fine, Ventosa\WObj:=wobj0;
ENDFOR
SetDO SD_ActivaVentosa, 0;
WaitDI ED_PiezaCogida, 0;
MoveL pReposo, v800, z100, Ventosa\WObj:=wobj0;
ENDFOR
ENDPROC

ENDMODULE

My question is how to make the movement from the tower of pieces to the destination point, where I want to place the pieces equally depending on nTorresDestino, and go placing a piece in each tower. See illustrative example video and image.

The test video can be seen in the following link of my Google Drive: