WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-04-2009, 09:29 AM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
removing multiple objects

Hello,

I cannot figure out how to remove or delete multiple objects that have been created this way:

Code:
	def balls():
		ball = ballOriginal.copy()
		ball.scale(.5,.5,.5)
		ball.collideSphere()
		ball.setPosition([0,20,0])
	vizact.ontimer2(0,200,balls)
How can I remove all 200 of those balls?

Thanks
Reply With Quote
  #2  
Old 08-04-2009, 04:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You should save each object you create into a global list. Then you can periodically go through the list and remove the objects.
Reply With Quote
  #3  
Old 08-04-2009, 05:01 PM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Is there a good example of this to follow?
Reply With Quote
  #4  
Old 08-04-2009, 05:09 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I'm not sure there is an example that does exactly what you want, but the Duck Court example script that comes with Vizard shows how to save objects into a global list so they can be referenced later.
Reply With Quote
  #5  
Old 08-05-2009, 08:31 AM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Code:
	
ballList = []         

def balls():
     ball = ballOriginal.copy()
     ball.scale(.5,.5,.5)
     ball.collideSphere()
     ball.setPosition([0,20,0])
     ballList.append(ball)
vizact.ontimer2(0,200,balls)
So I added a global list... how do you "periodically go through the list and remove the objects"? I tried ballList.remove() and that didn't work.
Reply With Quote
  #6  
Old 08-05-2009, 10:02 AM
GiudiceLab GiudiceLab is offline
Member
 
Join Date: May 2009
Location: Orono, ME
Posts: 49
I'm not sure if I understand exactly what you want to do, but if you first make the global list and then want to take all the balls out of it, you could:

Code:
for row in range(len(ballList)):
		ballList[row].remove()
which will cycle through your list and remove each item.

Or, you could just erase your list by re-initializing it (I think):
Code:
ballList = []
Reply With Quote
  #7  
Old 08-05-2009, 10:13 AM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Ok I will give that a try later... thanks for the feedback
Reply With Quote
  #8  
Old 08-05-2009, 10:15 AM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Great I think it worked.
Reply With Quote
Reply


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
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 04:09 AM
multiple objects durf Vizard 1 04-10-2009 02:42 PM
Moving multiple objects with ppt durf Vizard 1 02-10-2009 04:03 PM
Problems with making multiple objects from one .wrl? mjabon Vizard 3 07-10-2007 02:23 PM
Could not find plugin to load objects... halley Vizard 1 05-30-2006 12:01 PM


All times are GMT -7. The time now is 08:27 PM.


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