### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >

# 17. `actors` — OpenGL actors for populating the 3D scene.

`Classes defined in module actors`

class `actors.``Actor`(**kargs)

  An Actor is anything that can be drawn in an OpenGL 3D Scene.

  The visualisation of the Scene Actors is dependent on camera position and angles, clipping planes, rendering mode and lighting.

  An Actor subclass should minimally reimplement the following methods:

  - bbox(): return the actors bounding box.
  - drawGL(mode): to draw the actor. Takes a mode argument so the drawing function can act differently depending on the mode. There are currently 5 modes: wireframe, flat, smooth, flatwire, smoothwire. drawGL should only contain OpenGL calls that are allowed inside a display list. This may include calling the display list of another actor but not creating a new display list.

  The interactive picking functionality requires the following methods, for which we porvide do-nothing defaults here:

  - npoints():
  - nelems():
  - pickGL():
  `bbox`()

    Default implementation for bbox().

  `drawGL`(**kargs)

    Perform the OpenGL drawing functions to display the actor.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``TranslatedActor`(A, trl=(0.0, 0.0, 0.0), **kargs)

  An Actor translated to another position.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``RotatedActor`(A, rot=(1.0, 0.0, 0.0), twist=0.0, **kargs)

  An Actor rotated to another position.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``CubeActor`(size=1.0, color=[(1.0, 0.0, 0.0), (0.0, 1.0, 1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 1.0), (0.0, 0.0, 1.0), (1.0, 1.0, 0.0)], **kargs)

  An OpenGL actor with cubic shape and 6 colored sides.

  `drawGL`(**kargs)

    Draw the cube.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``SphereActor`(size=1.0, color=None, **kargs)

  An OpenGL actor representing a sphere.

  `drawGL`(**kargs)

    Draw the cube.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``BboxActor`(bbox, color=None, linewidth=None, **kargs)

  Draws a bbox.

  `drawGL`(**kargs)

    Always draws a wireframe model of the bbox.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``AxesActor`(cs=None, size=1.0, color=[(1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)], colored_axes=True, draw_planes=False, linewidth=None, **kargs)

  An actor showing the three axes of a CoordinateSystem.

  If no CoordinateSystem is specified, the global coordinate system is drawn.

  The default actor consists of three colored lines of unit length along the unit vectors of the axes and three colored triangles representing the coordinate planes. This can be modified by the following parameters:

  size: scale factor for the unit vectors. color: a set of three colors to use for x,y,z axes. colored_axes = False: draw black axes. draw_planes = False: do not draw the coordinate planes.

  `drawGL`(**kargs)

    Draw the axes.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``GridActor`(nx=(1, 1, 1), ox=(0.0, 0.0, 0.0), dx=(1.0, 1.0, 1.0), linecolor=(0.0, 0.0, 0.0), linewidth=None, planecolor=(1.0, 1.0, 1.0), alpha=0.2, lines=True, planes=True, **kargs)

  Draws a (set of) grid(s) in one of the coordinate planes.

  `drawGL`(**kargs)

    Draw the grid.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``CoordPlaneActor`(nx=(1, 1, 1), ox=(0.0, 0.0, 0.0), dx=(1.0, 1.0, 1.0), linecolor=(0.0, 0.0, 0.0), linewidth=None, planecolor=(1.0, 1.0, 1.0), alpha=0.5, lines=True, planes=True, **kargs)

  Draws a set of 3 coordinate planes.

  `drawGL`(**kargs)

    Draw the grid.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``PlaneActor`(nx=(2, 2, 2), ox=(0.0, 0.0, 0.0), size=((0.0, 1.0, 1.0), (0.0, 1.0, 1.0)), linecolor=(0.0, 0.0, 0.0), linewidth=None, planecolor=(1.0, 1.0, 1.0), alpha=0.5, lines=True, planes=True, **kargs)

  A plane in a 3D scene.

  `drawGL`(**kargs)

    Draw the grid.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

  `setColor`(color=None, colormap=None, ncolors=1)

    Set the color of the Drawable.

class `actors.``GeomActor`(data, elems=None, eltype=None, color=None, colormap=None, bkcolor=None, bkcolormap=None, alpha=1.0, mode=None, linewidth=None, linestipple=None, marksize=None, **kargs)

  An OpenGL actor representing a geometrical model.

  The model can either be in Formex or Mesh format.

  `vertices`()

    Return the vertives as a 2-dim array.

  `setColor`(color, colormap=None)

    Set the color of the Actor.

  `setBkColor`(color, colormap=None)

    Set the backside color of the Actor.

  `setAlpha`(alpha)

    Set the Actors alpha value.

  `drawGL`(canvas=None, mode=None, color=None, **kargs)

    Draw the geometry on the specified canvas.

    The drawing parameters not provided by the Actor itself, are derived from the canvas defaults.

    mode and color can be overridden for the sole purpose of allowing the recursive use for modes ending on ‘wire’ (‘smoothwire’ or ‘flatwire’). In these cases, two drawing operations are done: one with mode=’wireframe’ and color=black, and one with mode=mode[:-4].

  `pickGL`(mode)

    Allow picking of parts of the actor.

    mode can be ‘element’, ‘edge’ or ‘point’

  `select`(sel)

    Return a GeomActor with a selection of this actor’s elements

    Currently, the resulting Actor will not inherit the properties of its parent, but the eltype will be retained.

  `setLineWidth`(linewidth)

    Set the linewidth of the Actor.

  `setLineStipple`(linestipple)

    Set the linewidth of the Actor.

`Functions defined in module actors`

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex v0.8.6 documentation >
- pyFormex reference manual >