[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objects in loop



I have not quite figured our why do you have to *destroy* the objects.
Why not place them into an OBJARR, save it and use Setproperty, pos=***
to simply move the objects to new positions, then re-draw the view?
Destroying works, too, but by moving them instead you'd save
destruction-creation overhead. Besides, ORB is a subclass of IDLgrMODEL,
so it has a ton of useful parameters that you can alter instead of re-creating.

Cheers,
Pavel

Murray Shearer wrote:
> 
> I want to insert a bunch of spheres to represent instrument locations
> into my model. At the moment I have something like:
> 
> for p=0,a   do begin
>         ip      =       OBJ_NEW('orb',pos=[x(p), y(p), z(p)])
>         model   -> ADD, ip
> endfor
> 
> Where x, y and z are instrument coords.
> 
> This did work fine (although I guess it is not technically correct) I
> could see all my instruments.
> 
> The problem is this bit of code is part of a program for creating
> animations of data. When I want to change the instrument location I
> destroy the model and recreate from scratch, which also works (for the
> first couple of animations at least). However after a few loops IDL
> turns into a memory gobbling monster, windows has a whine about running
> out of memory and promptly collapses into a gibbering heap (this may be
> because I am running 5.3 in Win2000?).
> 
> I think the solution might be to reuse the model after destroying only
> the spheres that represent instrument location (since that is all I
> really want to change). However because of the way I created the
> spheres I canít destroy them.
> 
> My question is therefore how do I create my spheres so that they are
> all one object or automatically generate them with individual names?
> 
> Ps. I used to use mesh_obj to create the spheres but thanks to a recent
> posting I now use orb, which is much neater!
> 
> Sent via Deja.com
> http://www.deja.com/