Mark center: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(Created page with "Mark_center is a small callback that puts a cross at the center of space, where the camera is pointing. You could also use this to setup arbitrary CGOs (points, lines, etc) ...")
 
(don't use misleading homogenous argument)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Infobox script-repo
|type      = module
|filename  = mark_center.py
|author    = [[User:Inchoate]]
|license  = BSD-2-Clause
}}
[[Mark_center]] is a small callback that puts a cross at the center of space, where the camera is pointing.
[[Mark_center]] is a small callback that puts a cross at the center of space, where the camera is pointing.


Line 8: Line 15:
def crosshair_put_center():
def crosshair_put_center():
   t = cmd.get_position()
   t = cmd.get_position()
   m = [1, 0, 0, t[0], 0, 1, 0, t[1], 0, 0, 1, t[2], 0, 0, 0, 1]
   m = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0] + t + [1]
   cmd.set_object_ttt('crosshair', m, homogenous=1)
   cmd.set_object_ttt('crosshair', m)


cmd.load_callback(crosshair_put_center, '_crosshair_cb')
cmd.load_callback(crosshair_put_center, '_crosshair_cb')
Line 17: Line 24:
</source>
</source>


[[Category:Scripts]]
[[Category:Script_Library]]
[[Category:Math_Scripts]]
[[Category:Math_Scripts]]

Latest revision as of 19:46, 2 March 2017

Type Python Module
Download mark_center.py
Author(s) User:Inchoate
License BSD-2-Clause
This code has been put under version control in the project Pymol-script-repo

Mark_center is a small callback that puts a cross at the center of space, where the camera is pointing.

You could also use this to setup arbitrary CGOs (points, lines, etc) in 3D space.

from pymol import cmd

def crosshair_put_center():
   t = cmd.get_position()
   m = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0] + t + [1]
   cmd.set_object_ttt('crosshair', m)

cmd.load_callback(crosshair_put_center, '_crosshair_cb')

cmd.pseudoatom('crosshair', pos=(0,0,0))
cmd.show_as('nonbonded', 'crosshair')