From: Thomas H. <tho...@sc...> - 2013-03-12 02:53:46
|
Along those lines: The script "SelectClipped" from the PyMOLWiki does a good job here, at least for spheres. http://pymolwiki.org/index.php/SelectClipped Example (after having loaded the script or installed it with the plugin manager): PyMOL> select_clipped PyMOL> hide everything, not clipped PyMOL> clip atoms, 2, clipped Cheers, Thomas On Mar 11, 2013, at 4:38 PM, Tsjerk Wassenaar <ts...@gm...> wrote: > # Hey :) > > # Here is a work around... > > # First import the numpy module > import numpy > > # Then store the viewing matrix as 6 by 3 numpy array. > M=numpy.array(cmd.get_view()).reshape(6,3) > > # Now place a pseudoatom at the position of the camera > # Turn off autozoom to keep the view > set auto_zoom, 0 > scale=1.0 > cmd.pseudoatom("dummy",pos=list(M[4,:]-scale*numpy.dot(M[:3,:3],M[3,:]))) > > # The dummy can now be used to hide all spheres within a cutoff distance. E.g. > hide spheres, all within 150 of dummy > > # You may need to play with the distance to get the right effect. > # It is possible to use the distances of the original clipping planes, > # by extracting those from the viewing matrix. > # The 'scale' parameter can be used to adjust the effect. > # If scale > 1, the dummy is placed behind the camera, which may be > # required for a proper planar cut. > # On the other hand, you can set it to < 1, to put the dummy closer to > # the scene and cut out a spherical region. > > # Note that you can change the view after this operation and have a > nice sideview > # of a clipped system, or use it to clip a system multiple times from > different sides. > > # Enjoy! > > # Cheers, > > # Tsjerk -- Thomas Holder PyMOL Developer Schrödinger Contractor |