Difference between revisions of "TransformSelectionByCameraView"

From PyMOLWiki
Jump to: navigation, search
(transpose=1)
 
Line 1: Line 1:
 
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.
 
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/
  
 
<source lang="python">
 
<source lang="python">
Line 19: Line 21:
 
   cv[3:6]+[0.0]+ \
 
   cv[3:6]+[0.0]+ \
 
   cv[6:9]+[0.0]+ \
 
   cv[6:9]+[0.0]+ \
   cv[12:15]+[1.0])
+
   cv[12:15]+[1.0], transpose=1)
  
 
cmd.reset()
 
cmd.reset()

Latest revision as of 19:28, 29 November 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()