WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   General question and question regarding arrays (https://forum.worldviz.com/showthread.php?t=1309)

dan12345 01-15-2008 09:35 AM

General question and question regarding arrays
 
Hello -
I started working now in a psychology department which purchased worldviz,
thus i am a newbie - so i will probably be harrassing this forum alot. My first question, is whether this forum is indeed the place i should go to to ask technical questions (such as the following question) regarding the program - or should I maybe contact the support email? This forum is run by the worldviz
team too, right?

and the second question is small, but functions as an excuse for the post -
i read in the tutorial that i can write something like
object = viz.add('file location')
and then manipulate object.
if i want to create an array of objects, in which arr(i) will hold an object seperately for later manipulation, how do i do it? i can create the for loop
to create the objects, but i don't know how to store them outside the loop...
hope i was clear enough.

and if i'm already at it - when i add from a file location, how can i specify exactly where the file is at, assuming it's not in the resources folder?

and if i'm already already at it - just to get a feel who reads this forum and uses the program, it would be nice if anyone who reads this will just reply
with general details about himself - i .e . for what needs he is using the program, for how long, is he satisfied with it....

thanks,
dan

farshizzo 01-15-2008 10:15 AM

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.


All times are GMT -7. The time now is 05:19 AM.

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