21. actors — OpenGL actors for populating the 3D scene. — pyFormex 0.9.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex 0.9.1 documentation >
- pyFormex reference manual >

# 21. `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 provide 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data of the Drawable.

class `actors.` `AxesActor`(cs=None, size=1.0, psize=0.5, color=[(1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)], colored_axes=True, draw_planes=True, draw_reverse=True, linewidth=2, alpha=0.5, **kargs)

  An actor showing the three axes of a coordinate system.

  If no coordinate system 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data 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 Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

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

    Set the color of the Drawable.

  `setTexture`(texture)

    Set the texture data of the Drawable.

class `actors.` `Text3DActor`(text, font, facesize, color, trl)

  A text as a 3D object.

  This class provides an Actor representing a text as an object in 3D space.

  `setLineWidth`(linewidth)

    Set the linewidth of the Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

  `setTexture`(texture)

    Set the texture data of the Drawable.

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

  An OpenGL actor representing a geometrical model.

  The model can either be in Formex or Mesh format.

  `nplex`()

    Return the plexitude of the elements in the actor.

  `nelems`()

    Return the number of elements in the actor.

  `shape`()

    Return the number and plexitude of the elements in the actor.

  `points`()

    Return the vertices 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, bkalpha)

    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’, ‘face’, ‘edge’ or ‘point’

  `setLineWidth`(linewidth)

    Set the linewidth of the Drawable.

  `setLineStipple`(linestipple)

    Set the linewidth of the Drawable.

  `setTexture`(texture)

    Set the texture data of the Drawable.

  `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.

`Functions defined in module actors`

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex 0.9.1 documentation >
- pyFormex reference manual >