schrodinger.graphics3d.box module

Maestro 3D boxes.

The box module allows creation and drawing of boxes and parallelepipeds. A box is a special case of a parallelepiped where angles between edges are 90° and edges are parallel to the XYZ axes.

Control over the positioning, color, and opacity of a box are provided. See the MaestroBos and MaestroParallelepiped classes for more info.

To draw any number of boxes, create the class instances, add them to a Group instance then invoke the Group’s draw() method.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.graphics3d.box.MaestroParallelepiped(points, color, opacity=1.0, line_width=1.0, style=0)

Bases: schrodinger.graphics3d.common.Primitive

Class for placing a parallelepiped into the Workspace. Can be used for drawing boxes that are not positioned with edges parallel to 3 axes.

3D objects should be added to a graphics3d.common.Group. See the graphics3d.common.Group documentation.

See note on transparency in the module level docstring.

API Example:

import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.common as common
import schrodinger.graphics3d.box as box

box_grp = common.Group()
st = maestro.workspace_get()
bx = box.Parallelepiped(
    points=[origin, xyz2, xyz3, xyz4]
    color='red',
    opacity=1.0,
    style=box.LINE
)
# Add the primitive to the container.
box_grp.add(bx)

# Hide the markers.
box_grp.hide()

# Remove the markers and the callback.
box_grp.clear()
__init__(points, color, opacity=1.0, line_width=1.0, style=0)

Constructor requires:

points: List of 4 (x, y, z) coordinates, representing half of the

corners of the box. First coordinate must be adjacent to each of the other 3 coordinates.

color: One of:

Color object Color name (string) Tuple of (R, G, B) (each 0.0-1.0)

Optional arguments:

opacity: 0.0 (invisible) through 1.0 (opaque)

Defaults to 1.0

line_width: Line width. Default is 1.0.

style: FILL, LINE or DASHED_LINE. Default is LINE.

class schrodinger.graphics3d.box.MaestroBox(center, extents, color, opacity=1.0, line_width=1.0, style=0)

Bases: schrodinger.graphics3d.box.MaestroParallelepiped

Class for placing a 3D box into the Workspace. Edges of the box will be aligned with X/Y/Z axes. For custom rotation, or to create “skewed” boxes, use MaestroParallelepiped class.

3D objects should be added to a graphics3d.common.Group. See the graphics3d.common.Group documentation.

See note on transparency in the module level docstring.

API Example:

import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.common as common
import schrodinger.graphics3d.box as box

box_grp = common.Group()
st = maestro.workspace_get()
bx = box.Box(
    center=(x, y, z),
    extents=(10, 10, 10),
    color='red',
    opacity=1.0,
    style=box.LINE
)
# Add the primitive to the container.
box_grp.add(bx)

# Hide the markers.
box_grp.hide()

# Remove the markers and the callback.
box_grp.clear()
__init__(center, extents, color, opacity=1.0, line_width=1.0, style=0)

Constructor requires:

center: List of 3 Angstrom values indicating the center coordinate

of the box.

extents: List of 3 float values in Angstroms -

x length, y length, z length.

color: One of:

Color object Color name (string) Tuple of (R, G, B) (each 0.0-1.0)

Optional arguments:

opacity: 0.0 (invisible) through 1.0 (opaque)

Defaults to 1.0

line_width: Line width. Default is 1.0.

style: FILL, LINE or DASHED_LINE. Default is LINE.