TransformSelectionByCameraView: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
mNo edit summary
(transpose=1)
 
(2 intermediate revisions by one other user not shown)
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()
</source>
</source>
[[Category:Scripting_Script_Library]]
[[Category:Script_Library]]
[[Category:Math_Scripts]]

Latest revision as of 18: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()