Here is an example script that shows how to create a 2D array of objects and position them in a grid structure. Let me know if anything is unclear.
Code:
import viz
viz.go()
#Width, height of grid
GRID_SIZE = [10,5]
#Spacing between grid items
GRID_SPACING = 1.0
#2D array of blocks
blocks = []
#Iterate over x-axis
for x in range(GRID_SIZE[0]):
column = []
#Iterate over y-axis
for y in range(GRID_SIZE[1]):
#Create block (copy file from cache)
b = viz.add('white_ball.wrl',cache=viz.CACHE_COPY)
#Position block in grid
b.setPosition(x*GRID_SPACING,0,y*GRID_SPACING)
#Add block to current column
column.append(b)
blocks.append(column)
#Set color of block (3,1) to red
blocks[3][1].color(viz.RED)
#Add environment
import vizshape
vizshape.addGrid(color=[0.2]*3)
viz.clearcolor(viz.GRAY)
#Setup camera navigation
import vizcam
cam = vizcam.PivotNavigate(center=(0,0,0))
cam.rotateTo(0,10,-20)