Vincent,

I think this can also be done in Python, in case you prefer that. In the Python API, there's a `run` function for running commands. For a lot of commands, this function will return a relevant value. For example:

from chimerax.core.commands import run
vol = run(session, "measure volume #1")

`session` is defined by default as the current ChimeraX session. `vol` is the total enclosed volume of #1.

Best,

Tony

On Fri, Jul 21, 2023 at 9:38 AM Elaine Meng via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Vincent,
We're glad you like ChimeraX!

Without resorting to python, you can do some looping by embedding your current commands in a perframe command.  The level value in your volume command would be the $1 variable to gradually change in the loop.  See perframe description and examples to see if it can do what you want (may take some experimentation, I usually have a few rounds of trial and error with this kind of thing myself):

<https://rbvi.ucsf.edu/chimerax/docs/user/commands/perframe.html>

I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jul 21, 2023, at 1:52 AM, Vincent Mallet via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
>
> Hello,
>
> Thanks a lot for the awesome tool !
>
> I have a question about how to use some commands that are not yet included in the python API : for instance "measure volume".
> I can run it using a cxc with : /usr/bin/chimerax --script measure.cxc --nogui --exit
> Where measure.cxc contains looks like :
> open test.mrc
> volume #1 level 0.42
> measure volume #1
>
> I don't understand how to do the same with a python script. Is there some way to use chimerax.tools(measure area/volume) to get this tool to work from within a python script ?
>
> My use case is that I am running this measurement for different thresholds, and I would like those thresholds to depend on the value of previous thresholds, hence I need looping. For now, I am calling subprocess on the .cxc command above from a python script, but this means that I need to load the mrc every time...
>
> Thanks in advance for your help !
>
> Best,
> Vincent


_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/