From: Axel Kohlmeyer (akohlmey_at_vitae.cmm.upenn.edu)
Date: Tue Nov 29 2005 - 13:11:17 CST

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>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.