View Single Post
  #2  
Old 01-15-2008, 10:15 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a sample script that shows how to create an array of objects:
Code:
import viz
viz.go()

#Example code for creating arrays
balls = []
for x in range(10):
	#Create a ball and set its position
	ball = viz.add('ball.wrl')
	ball.setPosition(0,0,x)
	#Append ball object to array
	balls.append(ball)
	
	
#Example code for using arrays
print balls
print len(balls)
for b in balls:
	print b.getPosition()
When you add a file, Vizard will first check if the path exists relative to the script directory. If it does not exist, then it will look for the file in the resource path.
Reply With Quote