Dear Mike,

> Where would I store the reference to the object (containing my data) so
> that I can retrieve it on the second call?  Can I link it to the CGO object
> or something?

You can reference the object in Your Python script just like:

my_data = []

(but i'd prefer using a class for that). What is important is that a 
cmd.extend(x,y) call should be called somewhere in the script, otherwise 
Python thinks the data will be no longer used and calls the Garbage 
Collection.

Kristian


> ----- Original Message -----
> From: "Kristian Rother" <kristian.rot...@charite.de>
> To: "Mike Liang" <mli...@stanford.edu>
> Cc: <pymol-users@lists.sourceforge.net>
> Sent: Thursday, January 30, 2003 3:53 AM
> Subject: Re: [PyMOL] Associating data structure with CGO object
>
> > Dear Mike,
> >
> > You can at least do the following:
> >
> > *** first call of command ***
> > - parse the file
> > - store the data in an object (dictionary, list, etc.) - you can probably
> > store the Strings that make up the CGO object.
> > - refine the data using the cutoff
> > - create CGO object from refined data
> >
> > *** second call of command ***
> > - delete CGO object
> > - refine the data using the cutoff
> > - create CGO object from refined data
> >
> > Message: You can create objects in Python scripts that are persistent as
> long
> > as PyMOL is running.
> > This should work a lot faster than parsing the file several times.
> >
> > Kristian
> >


Reply via email to