Style

mechanica.Style

alias of MxStyle

class mechanica.MxStyle(*args)

The Mechanica style type

property visible: bool

Visibility flag

property colormap

Style color map

property mapper

Color mapper of this style

setColor(colorName: std::string const &) HRESULT

Set the color by name

Parameters

colorName (string) – name of color

Return type

int

Returns

HRESULT

newColorMapper(*args, **kwargs) void

Construct and apply a new color map for a particle type and species

Parameters
  • partType (MxParticleType) – particle type

  • speciesName (string) – name of species

  • name (string) – name of color map

  • min (float) – minimum value of map

  • max (float) – maximum value of map

toString() std::string

Get a JSON string representation

Return type

string

Returns

std::string

static fromString(str: std::string const &) MxStyle *

Create from a JSON string representation.

Parameters

str (string) –

Return type

MxStyle

Returns

MxStyle*

__reduce__()

Helper for pickle.

mechanica.ColorMapper

alias of MxColorMapper

class mechanica.MxColorMapper(*args)

The color mapping type

Construct a new color map for a particle type and species

Parameters
  • partType (MxParticleType) – particle type

  • speciesName (string) – name of species

  • name (string) – name of color mapper function

  • min (float) – minimum value of map

  • max (float) – maximum value of map

property names

Names of available color maps

property min_val

minimum value of map

property max_val

maximum value of map

set_colormap(s: std::string const &) bool

Try to set the colormap.

If the map doesn’t exist, does not do anything and returns false.

Parameters

s (string) – name of color map

Return type

boolean

Returns

true on success