Package schrodinger :: Package graphics3d :: Module polyhedron :: Class MaestroCube
[hide private]
[frames] | no frames]

Class MaestroCube

      object --+            
               |            
common.Primitive --+        
                   |        
          Polyhedron --+    
                       |    
   MaestroPolyhedronCore --+
                           |
                          MaestroCube
Known Subclasses:


Class to draw a 3D cube in Maestro's Workspace.

See doc string for __init__ for details on instantiation.

Cubes should be added to a graphics3d.common.Group, 
or CubeGroup, and drawing done via the Group.  
See the L{graphics3d.common.Group} documentation.


API Example
-----------
import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.polyhedron as polyhedron

cube_group = polyhedron.Group()
st = maestro.workspace_get() # Here, st is methane.
for atom in st.atom:
    if atom.element == 'C':
        center = atom.xyz

cube = polyhedron.Cube(
    center  = center,
    mode = polyhedron.MODE_MAESTRO,
    length  = 1.828, # length between Hs
    color   = 'goldenrod',
    opacity = 1.0,
    style   = polyhedron.LINE
)
# Add the primative to the container.
cube_group.add(cube)

# Show the markers
cube.show()
cube_group.show()

# Hide the markers.
cube_group.hide()

# Remove the markers and the callback.
cube_group.clear()

Instance Methods [hide private]
 
__init__(self, center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)
Create a polyhedron centered at center.
 
getVertices(self, center, length=None, radius=None, volume=None)
Get a list of vertices.
 
getIndices(self)
@return The indices of the faces

Inherited from MaestroPolyhedronCore: getFaces, updateVertices

Inherited from Polyhedron: setStyle, update

Inherited from Polyhedron (private): _calculateBoundingBox, _draw, _setNormals

Inherited from common.Primitive: __del__, groupHidden, groupShown, hide, isGroupShown, isShown, setEntryID, setRightClickOnGObject, show

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]

Inherited from Polyhedron (private): _glReset, _glSetup

Class Variables [hide private]
Instance Variables [hide private]

Inherited from Polyhedron: faces, normals, vertices

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, center, mode, length=None, radius=None, volume=None, color='red', opacity=1.0, style=1)
(Constructor)

 

Create a polyhedron centered at center. Note that one of length, radius, volume is needed to create the shape.

Parameters:
  • center - List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
  • length - Length in Angstroms of each of the edges of the tetrahedron.
  • radius - Circumsphere radius in Angstroms from center of tetrahedron.
  • volume - Volume in cubed Angstroms of the object.
  • color - One of - Color object, Color name (string), or Tuple of (R, G, B) (each 0.0-1.0)
  • opacity - 0.0 (invisible) through 1.0 (opaque). Defaults to 1.0
  • style - LINE or FILL. Default is FILL.
Raises:
  • RuntimeError - If a single option from length, radius, and volume does not have a value.
  • ValueError - If the size parameter (length, radius, or volume) is not a float.
  • NotImplementedError - If the initiating subclass does not have a getVertices or getFaces method.
Overrides: object.__init__

getVertices(self, center, length=None, radius=None, volume=None)

 

Get a list of vertices. If the center coordinates are considered the origin the vertices will have a base on the y-plane, a vertex on the x-axis and a vertex directly in the +z-axis from the center.

Parameters:
  • center (List) - List of 3 Angstrom values indicating the center coordinate of the tetrahedron.
  • length (float) - Length in Angstroms of each of the sides of the tetrahedron. Note: length or radius must be specified to create tetrahedron.
  • radius (float) - Circumsphere radius in Angstroms from center of tetrahedron. Note: length or radius must be specified to create tetrahedron.
  • volume (float) - Volume in cubed Angstroms of the object.
Overrides: MaestroPolyhedronCore.getVertices

getIndices(self)

 

@return The indices of the faces

Overrides: MaestroPolyhedronCore.getIndices