|
From: Tsjerk W. <ts...@gm...> - 2013-03-11 20:38:35
|
# 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
|