This is a MEL script that you can copy and paste into the API. It creates a
similar set of objects that rotate simultatneously. In this case it is a
bunch of floor slabs separated by space that add up to make a primitive
building. I think the solution to your problem can be found in this
script.
//MEL Script for creating a building with 20 floors.
$size = 4;
$height = $i * $size;
$number_of_floors = 20;
$size = 4;
$i = 0;
while($i < $number_of_floors){
polyCube;
scale 20 .5 20;
$height = $i * $size;
move 0 $height 0;
$i++;
};