schrodinger.graphics3d.lines module

Maestro 3D lines.

The lines module allows creation and drawing of lines. Clients draw using Group instances not through Lines instances.

Control over the vertices, color, and width of the lines are provided. See the Lines class for more info.

To draw any number of lines that share the same color and width, then place them in a single Lines instance and add the instance to a Group instance (LinesGroup can be used and is a synonym). Then invoke the Group’s draw() method. A set of lines with a different width or color should be placed into a separate Lines instance.

Copyright Schrodinger, LLC. All Rights Reserved

class schrodinger.graphics3d.lines.MaestroLines(segments, color=None, width=1.0)

Bases: schrodinger.graphics3d.common.Primitive

Class representing a set of 3D lines to be added to the Workspace.

Lines with the same characteristics must be placed (color, width) into a single Lines instance.

API Example:

import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.common as common
import schrodinger.graphics3d.lines as lines

line_grp = common.Group()
st = maestro.workspace_get()
color='red'
displacement = 1.0
for at in st.atom:
    segments = [
        [(at.x - displacement, at.y, at.z), (at.x + displacement, at.y, at.z)],
        [(at.x, at.y - displacement, at.z), (at.x, at.y + displacement, at.z)],
        [(at.x, at.y, at.z - displacement), (at.x, at.y, at.z + displacement)],
    ]
    # Add the primatives to the container.
    line_grp.add(lines.Lines(segments, color=color))

# Hide the markers.
line_grp.hide()

# Remove the markers
line_grp.clear()
__init__(segments, color=None, width=1.0)

Lines constructor requires:

segments: List of segments, where each segments is a tuple/list of

2 (x,y,z) coordinates: [(x1, y1, z1), (x1, y2, z2)].

color: One of:

Color object (Color class) Color name (string) Tuple of (R, G, B) (each a float in range 0.0-1.0)

Optional arguments:

width (float): Defaults to 1.0. Lines are always drawn out

anti-aliased. So the actual width is determined at rasterization time. Not all widths are supported and if an unsupported width is chosen, the nearest supported with is used. Only width 1 is guaranteed to be supported.

groupHidden()

Called when the group of this object is hidden. Hide the Maestro object(s).

groupShown()

Called when the group of this object is shown. Show the Maestro object, if we are being shown.

hide()

Hide the object. It will not be drawn when the group is drawn.

isGroupShown()

Returns True if this object’s group is shown. False otherwise.

isShown()

Returns True if this object shown. False otherwise.

setEntryID(entry_id)

Sets entry ID for Maestro object (necessary to render in tile-by-entry mode.

Parameters

entry_id (str) – Object’s entry ID.

setGlowColor(r, g, b)

Sets glow color for the object.

Parameters
  • r (float) – Red component of glow color [0.0 .. 1.0]

  • g (float) – Green component of glow color [0.0 .. 1.0]

  • b (float) – Blue component of glow color [0.0 .. 1.0]

setIsGlowing(is_glowing)

Enables or disables glow effect for the object.

Parameters

is_glowing (bool) – Whether the object is glowing.

setRightClickOnGObject(pymodule, pyfunc)

Sets the python callback which should be called whenever given graphics object is right clicked.

Parameters
  • pymodule (str) – Python module

  • pyfunc (str) – Python function

show()

Display this object, if it was hidden