vtkmodules.util.views_rendering#

Pythonic overrides for the vtkViewsRendering module.

The wrapping layer already exposes snake_case properties (color, opacity, representation …) for every class in this module, and enum properties backed by Set<Prop>To<Name>() methods already accept strings (e.g. rep.representation = "wireframe", view.selection_mode = "frustum"). These overrides add the few things the wrapping does not provide on its own:

  • named colors – color="tomato", resolved via :mod:vtkmodules.util.colors

  • a fluent view.show(source, color=...) helper that creates, configures, and adds a representation in one call

  • view += representation / view -= representation

  • view.size = (width, height)

The layer is registered for vtkViewsRendering in vtkmodules/__init__.py.in and loaded automatically when that module is imported.

Module Contents#

Classes#

SurfaceRepresentation

vtkSurfaceRepresentation with named-color color/edge_color.

StandardRenderView

vtkStandardRenderView with named-color background, size, show().

Functions#

_make_representation

Build a representation for representation_type.

_resolve_color

Return an (r, g, b) tuple for color.

Data#

API#

vtkmodules.util.views_rendering.REPRESENTATION_TYPES#

None

vtkmodules.util.views_rendering._make_representation(representation_type)#

Build a representation for representation_type.

Accepts None (a surface representation), a name from :data:REPRESENTATION_TYPES, or a representation class.

vtkmodules.util.views_rendering._resolve_color(color)#

Return an (r, g, b) tuple for color.

color is either a 3-sequence with components in [0, 1] or a snake_case named color from :mod:vtkmodules.util.colors (e.g. "tomato", "steel_blue").

class vtkmodules.util.views_rendering.SurfaceRepresentation#

Bases: vtkmodules.vtkViewsRendering.vtkSurfaceRepresentation

vtkSurfaceRepresentation with named-color color/edge_color.

property color#
property edge_color#
class vtkmodules.util.views_rendering.StandardRenderView#

Bases: vtkmodules.vtkViewsRendering.vtkStandardRenderView

vtkStandardRenderView with named-color background, size, show().

property background#
property background2#
property size#
__iadd__(representation)#
__isub__(representation)#
show(input, representation_type=None, **properties)#

Add a representation for input to the view and return it.

input is a vtkAlgorithm (its output port is connected) or a vtkDataObject. Keyword arguments are applied as properties on the created representation::

view.show(sphere, color="tomato", opacity=0.8,
          representation="surfacewithedges")

representation_type selects what to build: a name from :data:REPRESENTATION_TYPES, a representation class, or None for a surface representation::

view.show(wavelet, "volume", scalar_opacity_unit_distance=0.8)
view.show(wavelet, MyRepresentation)