Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.

The script creates a squared array of cubes on a circle and dyes the objects. Since the script works with integers only uneven numbers of cubes (3, 5, 7 ,9, etc.) can be used for "dimRange":

numCubes    = 5 # creates numCubes x numCubes object.
dimRange    = (numCubes - 1) / 2
cubeCounter = 0
 
for i in range(-dimRange, dimRange + 1):
	for j in range(-dimRange, dimRange + 1):
		cube = scene.addCube()
		cube.setParameter("Position", Vector.new(i, 0, j))
		# Use this line for Z-based setups:
		# cube.setParameter("Position", Vector.new(i, j, 0))
 
		# Here, the % (modulo) operator selects every 2nd cube
		if (cubeCounter % 2 == 0): cube.setParameter("Color", Vector.new(255,255,255))
		else                     : cube.setParameter("Color", Vector.new(255,32,32))
 
		cubeCounter += 1


 

  • No labels