From: Mario Valle (mvalle_at_cscs.ch)
Date: Wed Nov 30 2005 - 04:01:49 CST

Huge improvement! Thanks.
Could the graphics page
<http://www.ks.uiuc.edu/Research/vmd/current/ug/node114.html>
be updated with delete all?
Now the relevant code is
     # defer screen update
     display update off

     # delete an existing surface
     graphics $mol delete all

     # add triangles
     graphics $mol color $comp
     foreach line [split $data \n] {
         if {$line == ""} break
         eval graphics $mol trinorm $line
     }

     # update the display
     display update on

Thanks again!
                        mario

Axel Kohlmeyer wrote:
> On Tue, 29 Nov 2005, Mario Valle wrote:
>
> MV> In a small plugin I'm developing I need to create a different surface for each animation step.
> MV>
> MV> The surfaces are create using a bunch of graphics $mol trinorm ... calls.
> MV> At each animation step I need to delete the surface created in the previous step before
> MV> recreating the new one. Unfortunately this step slows down considerably the animation.
> MV>
> MV> The only method I have found is:
> MV> # delete an existing surface
> MV> set glist [graphics $mol list]
> MV> foreach gitem $glist {graphics $mol delete $gitem}
> MV>
> MV> Is there any more efficient method?
>
> at least for the deleting you can do
> graphics $mol delete all
> which should reduce the overhead.
>
> if you need to update only part of the graphics, you can save those
> graphics ids while creating them, and then just use that list
> of graphics ids to delete and recreate them. as in:
> http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part7.html#chap9_sect1
>
> MV> I create the graphics inside the Top molecule. Maybe it is faster to create the graphics
> MV> inside a new molecule and then deleting it at each animation step. Unfortunately using
> MV> this setup I have strange scaling and translation of the resulting surface.
>
> hmmm, perhaps a suitable workaround would be to load each frame into
> a different molecule and then use a script to hide/unhide them. as in:
> http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part7.html#chap9_sect5
>
> axel.
>
> MV>
> MV> Thanks for your help!
> MV> mario
> MV>
> MV>
>

-- 
Ing. Mario Valle
Visualization Group                              | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82