Hi all,

I managed to solve the problem by looking at the cgo_arrow.py of Thomas Holder in the wiki: http://www.pymolwiki.org/index.php/Cgo_arrow


my line was incorrect:
cmd.load_cgo( [ CONE, x0, y0, z0, x1, y1, z1, radius, r1, g1, b1, r1, g1, b1 ], "cone_a" )

correct line:
cmd.load_cgo( [ CONE, x0, y0, z0, x1, y1, z1, radius, 0.0, r1, g1, b1, r1, g1, b1, 1.0, 0.0 ], "cone_a" )

of course, with the definition of x0, y0, etc... and the from pymol.cgo import ....

Have a good day.
Vincent


Le 8/26/14 12:19 AM, Andreas Warnecke a écrit :
Hej,

if you simply copy-paste the wiki entry into PyMOL you will get the error. This code is intended to be run as a block (e.g. from script) and creates e.g. problems with indentation, or other errors. A simple solution would be to wrap the commands to a block using "python" and "python end".

Either you include them in what copy paste (the whole shabang):

python
# axes.py
from  pymol.cgo  import  *
from  pymolimport  cmd
from  pymol.vfont  import  plain
# create the axes object, draw axes with cylinders coloured red, green,
#blue for X, Y and Z
obj= [
    CYLINDER,  0.,  0.,  0.,  10.,  0.,  0.,  0.2,  1.0,  1.0,  1.0,  1.0,  
0.0,  0.,
    CYLINDER,  0.,  0.,  0.,  0.,  10.,  0.,  0.2,  1.0,  1.0,  1.0,  0.,  1.0, 
 0.,
    CYLINDER,  0.,  0.,  0.,  0.,  0.,  10.,  0.2,  1.0,  1.0,  1.0,  0.,  0.0, 
 1.0,
    ]
# add labels to axes object (requires pymol version 0.8 or greater, I
# believe
cyl_text(obj,plain,[-5.,-5.,-1],'Origin',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[10.,0.,0.],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,10.,0.],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
cyl_text(obj,plain,[0.,0.,10.],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
# then we load it into PyMOL
cmd.load_cgo(obj,'axes')
python end

OR you can enter the lines/ copy paste sequentially.

If you are interested in arrows/ cones, have a look at the cgo_arrow script:
http://www.pymolwiki.org/index.php/Cgo_arrow

Hope this helps.

Cheers,

Andreas


On Mon, Aug 25, 2014 at 5:48 PM, vincent Chaptal <vincent.chap...@ibcp.fr <mailto:vincent.chap...@ibcp.fr>> wrote:

    Hi,

    I'm trying to draw arrows in Pymol 1.7.2 for mac, "à la
    http://www.pymolwiki.org/index.php/Axes "

    When I run the script for the Axes_with_nice_cones, I have the
    error message:
    File "/Applications/MacPyMOL.app/pymol/modules/pymol/parser.py",
    line 464, in parse
    exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
      File "<string>", line 1
        CONE, 0.0, 0.0,   l, 0.0, 0.0, h+l, d, 0.0, 0.0, 0.0, 1.0,
    0.0, 0.0, 1.0, 1.0, 1.0]
    ^
    SyntaxError: invalid syntax


    As a workaround, I tried to use the cylinder syntax (bellow, by
    replacing CYLINDER by CONE), pymol loads the object but doesn't
    draw anything.
    cmd.load_cgo( [ CONE, x0, y0, z0, x1, y1, z1, radius, r1, g1, b1,
    r1, g1, b1 ], "cone_a" )


    Can someone tell me what is going on and how I can draw a cgo CONE
    in pymol? It looks very nice.

    Thank you
    Vincent




--
    Vincent Chaptal, PhD

    Institut de Biologie et Chimie des Protéines

    Drug-resistance modulation and mechanism Laboratory

    7 passage du Vercors

    69007 LYON

    FRANCE

    +33 4 37 65 29 01 <tel:%2B33%204%2037%2065%2029%2001>

    http://www.ibcp.fr



    
------------------------------------------------------------------------------
    Slashdot TV.
    Video for Nerds.  Stuff that matters.
    http://tv.slashdot.org/
    _______________________________________________
    PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net
    <mailto: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



--

Vincent Chaptal, PhD

Institut de Biologie et Chimie des Protéines

Drug-resistance modulation and mechanism Laboratory

7 passage du Vercors

69007 LYON

FRANCE

+33 4 37 65 29 01

http://www.ibcp.fr


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
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