[Chimera-users] Center on surface at mouse accelerator

Daniel P Farrell danpf at uw.edu
Wed Aug 30 11:44:06 PDT 2017


Hello,

I found myself constantly needing to re-center on different regions of EM
density maps, and I was originally just dropping spheres on the surface,
centering on those, then deleting them.  Finally I got sick of that and
wrote this. It will center the window on the surface of whatever surface
the mouse is currently overlaying.

I found this to be a very helpful addition when looking at large EM maps,
and was thinking other people might too, after using it for a while I feel
as though it could be part of trunk since I use it so much.


basically it would require the addition of this to standard_accelerators.py

... other accelerators..

    ('zx', 'Center view on surface where mouse is located',
center_on_surface_at_mouse),

... zx because it's close to where you rest your hands on the keyboard...

def center_on_surface_at_mouse():
  from chimera import selection, tkgui
  hits = []
  w = tkgui.app.graphics
  x = w.winfo_pointerx() - w.winfo_rootx()
  y = w.winfo_pointery() - w.winfo_rooty()
  from Surface import surface_models
  import VolumePath.tracer as tracer
  hits.extend(tracer.surface_intercepts(x, y, surface_models()))
  xyz, model = tracer.closest_hit(hits)
  print(xyz)
  if xyz:
    print('cofr %f,%f,%f' % (xyz[0],xyz[1],xyz[2]))
    chimera.runCommand('cofr %f,%f,%f' % (xyz[0],xyz[1],xyz[2]))
    chimera.viewer.camera.center = xyz

cheers!
~Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20170830/0176add0/attachment.html>


More information about the Chimera-users mailing list