CGO#

class biotite.interface.pymol.CGO(values: ArrayLike | Sequence[float | floating])[source]#

Bases: object

A Compiled Graphics Object (CGO) describing a geometric shape that can be drawn in PyMOL.

Under the hood, a CGO is a sequence of floating point values comprising directives (see CGO.Type) and their arguments. Usually, a CGO is created via one of the get_xxx_cgo() functions and drawn via draw_cgo().

Parameters:
valuesarray-like, shape=(k,), dtype=float

The raw sequence of CGO directives and their arguments. Integer values are converted to floats, as PyMOL may otherwise fail to render the shape.

Attributes:
valuesndarray, shape=(k,), dtype=float

The raw values of the CGO.

Examples

>>> cgo = get_sphere_cgo(pos=(1.0, 2.0, 3.0), radius=1.5, color=(1.0, 0.0, 0.0))
>>> print(cgo)
CGO([6.0, 1.0, 0.0, 0.0, 7.0, 1.0, 2.0, 3.0, 1.5])
>>> print(cgo.values[0] == CGO.Type.COLOR)
True
class Type(*values)#

Bases: IntEnum

The directives a CGO may contain.

ALPHA = 25#
ALPHA_TRIANGLE = 17#
BEGIN = 2#
CHAR = 23#
COLOR = 6#
CONE = 27#
CUSTOM_CYLINDER = 15#
CYLINDER = 9#
DISABLE = 13#
DOTWIDTH = 16#
ELLIPSOID = 18#
ENABLE = 12#
END = 3#
FONT = 19#
FONT_AXES = 22#
FONT_SCALE = 20#
FONT_VERTEX = 21#
LINES = 1#
LINEWIDTH = 10#
LINE_LOOP = 2#
LINE_STRIP = 3#
NORMAL = 5#
NULL = 1#
PICK_COLOR = 31#
POINTS = 0#
QUADRIC = 26#
SAUSAGE = 14#
SPHERE = 7#
STOP = 0#
TRIANGLE = 8#
TRIANGLES = 4#
TRIANGLE_FAN = 6#
TRIANGLE_STRIP = 5#
VERTEX = 4#
WIDTHSCALE = 11#