This is a read-only mirror of pymolwiki.org

Difference between revisions of "TransformSelectionByCameraView"

From PyMOL Wiki
Jump to navigation Jump to search
(transpose=1)
m (1 revision)
 
(No difference)

Latest revision as of 04:40, 14 December 2015

This little script was posted to the PyMol list. It will orient the molucule like cmd.orient() does, but does so by the camera view.

https://sourceforge.net/p/pymol/mailman/message/10097639/

# transform selection coordinates by the camera view
#
# The script answers this:
#   Thanks!
#   But translate[x,y,z] only translate the molecule.
#   What I want  is to put longest length of molecule in the X axes, the 
#   second Y axes, the third z axes.
#   Just like what orient command does which change the view of camera but 
#   not the coordinates.
#   Now I want the coordinates also change after orient it.
#
cv=list(cmd.get_view())

cmd.transform_selection("all", \
  cv[0:3]+[0.0]+ \
  cv[3:6]+[0.0]+ \
  cv[6:9]+[0.0]+ \
  cv[12:15]+[1.0], transpose=1)

cmd.reset()