Next: imd
Up: Controlling VMD from Python
Previous: display
  Contents
  Index
Python operations available from the graphics module, used to
create custom 3-D objects from graphics primitives. The first argument to all
operations is the id of a Graphics molecule. Graphics molecules are created
using the load() command in the molecule module:
load('graphics', 'test') creates a Graphics molecule named 'test'. For
vertices and normals, a tuple with three float items is required.
- triangle(id, v1, v2, v3):
Draw a triangle with the given vertices.
- trinorm(id, v1, v2, v3, n1, n2, n3):
Draw a triangle with the given vertices and vertex normals.
- cylinder(id, v1, v2, radius=1.0, resolution=6, filled=0):
Draw a cylinder with endpoints specified by the given points. Radius,
resolution, and filled (whether the ends should be capped or not) may
be optionally specified with keyword arguments.
- point(id, v):
Draw a point at the given coordinates.
- line(id, v1, v2, style='solid', width=1):
Draw a line between the given vertices. Optionally, the line style
may be specified as either 'solid' or 'dashed', and width may be
any positive integer.
- materials(id, onoff):
Turns materials on/off for subsequent graphics primitives. Primitives
lying earlier in the stack are not affected. onoff should be
either 0 (off) or 1 (on).
- material(id, name):
Sets the material for all graphics primitives in this molecule.
name should be one of the material names returned by
material.listall().
- color(id, color):
Set the color for subsequent graphics primitives. color may be
(1) a tuple containing three floats specifying the RGB value, (2) an
integer corresponding to a color index, or (3) a string corresponding
to a color name.
- cone(id, v1, v2, radius=1.0, resolution=6):
Draw a cone with base at v1 and point at v2. radius and
resolution may optionally be specified with keyword arguments.
- sphere(id, center=(0.0, 0.0, 0.0), radius=1.0, resolution=6):
Draw a sphere. The sphere center, radius, and resolution may
optionally be specied with keyword arguments.
- text(id, pos, text, size=1.0):
Draw text at the given position (specified by a tuple of three floats,
using the string text. Size may optionally be specified using
keyword arguments.
- delete(id, index):
Deletes the graphics primitive with the given index. Alternatively,
if the string 'all' is passed as the index, all graphics primitives
will be deleted.
- replace(id, index):
Deletes the graphics primitive with the given index. The next graphics
primitive added will go in the newly vacated position. Subsequent
graphics primitives will resume at the end of the list.
- info(ind, index):
Returns a string describing the graphics primitive with the given
index. If the index is invalid, an IndexError exception is raised.
- listall(ind):
Returns the indices of the valid graphics primitives in a list.
Next: imd
Up: Controlling VMD from Python
Previous: display
  Contents
  Index
vmd@ks.uiuc.edu