WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A Little Programming Problem with MultiDimensional Arrays shivanangel Vizard 2 04-25-2007 12:21 PM
general question about <network>.send() shai Vizard 2 08-16-2005 03:04 PM


All times are GMT -7. The time now is 06:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC