Selection Exists: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
return 1 | return 1 | ||
return 0 | return 0 | ||
# Note from Warren: | |||
# | |||
# simpler, faster: | |||
def sele_exists(sele): | |||
return sele in cmd.get_names("selections") | |||
</source> | </source> | ||
[[Category: | [[Category:Script_Library|Selection Exists]] | ||
[[Category:ObjSel_Scripts]] |
Latest revision as of 07:35, 30 April 2009
#
# The function below will return true if the selection is defined.
#
from pymol import cmd
from types import *
def sele_exists(sele):
sess = cmd.get_session()
for i in sess["names"]:
if type(i) is ListType:
if sele==i[0]:
return 1
return 0
# Note from Warren:
#
# simpler, faster:
def sele_exists(sele):
return sele in cmd.get_names("selections")