Dear list,

Seems like I was able to find it myself by searching for "scene" in the
code on github.

The magic name is  "get_scene_list", which perhaps was not such a strange
name afterall

So, now I have put together a small script, to take all scenes in a pml
script and render them by running PyMOL on the command line like this:
pymol -c script.pml -r ray_scenes.py

Thanks to Jesper Karlsen (off-list) for pushing a bit further with this and
Tsjerk for introducing me to "invocation._argv"

Best regards,
Folmer


2016-02-01 15:19 GMT+01:00 Folmer Fredslund <folm...@gmail.com>:

> Dear list,
>
> Moving a bit further with this, I have been trying to find an easy way to
> iterate through the list of scene names. Or to get them somehow.
> I don't seem to be able to find any information about this and thought
> someone probably already knew.
>
> Thanks in advance!
>
> Folmer
>
> 2016-01-27 14:07 GMT+01:00 Folmer Fredslund <folm...@gmail.com>:
>
>> Dear Tsjerk,
>>
>> Thanks! simply including
>> if '-c' in invocation._argv
>> in the script works fine for me,
>>
>> Best,
>> Folmer
>>
>> 2016-01-27 12:43 GMT+01:00 Tsjerk Wassenaar <tsje...@gmail.com>:
>>
>>> Hey Folmer,
>>>
>>> You can check if '-c' not in invocation._argv
>>> Of course, you'd also need to check combinations, so it would be
>>> matching -.*c.* on the elements in _argv.
>>>
>>> There probably is a way to check for the GUI directly though.
>>>
>>> Hope it helps,
>>>
>>> Tsjerk
>>>
>>> On Wed, Jan 27, 2016 at 11:49 AM, Folmer Fredslund <folm...@gmail.com>
>>> wrote:
>>>
>>>> Hi there,
>>>>
>>>> I was wondering if there is a way to check if a .pml is being run in
>>>> command line mode (pymol -c), i.e. without the GUI.
>>>>
>>>> The reason I'm asking, is because I am making some scripts for figures,
>>>> and save the representations as scenes. It would be nice to both be able
>>>> to view them (running the .pml normally) and also make raytraced png's
>>>> when the .pml is being run in commandline mode.
>>>>
>>>> Best regards,
>>>> Folmer Fredslund
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>> _______________________________________________
>>>> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
>>>> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
>>>> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>>>>
>>>
>>>
>>>
>>> --
>>> Tsjerk A. Wassenaar, Ph.D.
>>>
>>>
>>
>>
>> --
>> Folmer Fredslund
>>
>
>
>
> --
> Folmer Fredslund
>



-- 
Folmer Fredslund
#!/usr/bin/python
# Run a pymol script with scenes like this:
# pymol -c your.pml -r thisscript.py
# and a png for every scene will be generated


from pymol import cmd
resolution = 500

pymol_flags = pymol.invocation._argv[1]
print "PyMOL flags: %s"%(pymol_flags)
if pymol_flags.startswith( '-' ):
    if "c" in pymol_flags:  
        for scene in cmd.get_scene_list():
            cmd.scene(key=scene, action='recall', animate=0)
            print "This is scene %s"%(scene)
            cmd.png(scene+".png", resolution, ray=1, dpi=300)

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to