TransformSelectionByCameraView

From PyMOLWiki
Revision as of 19:28, 29 November 2015 by Speleo3 (talk | contribs) (transpose=1)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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()