From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri Apr 28 2006 - 12:45:21 CDT

In addition to storing the IDs in discrete variables as in Axel's examples,
one can store them in a Tcl array (really a hash table), with something like:

set mygraphics(mygraphicsname) [draw sphere {0.0 0.0 -2.0}]
draw delete $mygraphics(mygraphicsname)

That might be more convenient to use if you expect to have a lot of named
graphics objects and you need to keep them together. You may want to
familiarize yourself with the Tcl array primitive:
  http://www.tcl.tk/man/tcl8.4/TclCmd/array.htm

  John

On Fri, Apr 28, 2006 at 01:32:59PM -0400, Axel Kohlmeyer wrote:
>
> On Fri, 28 Apr 2006, Enzo Vitale wrote:
>
> EV> Dear VMD developers,
>
> hi enzo,
>
> EV> I have two simple questions about the 'graphics' command:
> EV>
> EV> 1) is it possible to assign a NAME to a graphical object, so that it
> EV> is simpler to reference it in a script (instead of having to figure
> EV> out its number) ?
>
> no, but each graphics command returns the id of its object(s).
> and if you write scripts in the form of the ones shown e.g. at:
> http://www.theochem.ruhr-uni-bochum.de/~axel.kohlmeyer/cpmd-vmd/part7.html#chap9_sect1
> you can easily keep track of them.
>
> EV> 2) Is it possible to HIDE an object without deleting or replacing it,
> EV> so that it can be showed again later ?
>
> not as such. you could try using a second molecule and draw to
> that molecule without having any representations for that molecule.
> if you show/hide the second (third etc) 'molecule' the objects
> should be visible or disappear.
>
> EV> I use VMD 1.8.3 on Windows.
>
> ciao,
> axel.
>
> EV>
> EV> Thank you in advance,
> EV> Enzo
> EV>
>
> --
> =======================================================================
> 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.

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078