Rigid body graphics

Fill color

Fill color is specified as (red, green, blue, alpha) tuple. Red, green, blue, and alpha are specified as integers between 0 and 255. Without the alpha channel 16,777,216 (256 * 256 * 256) different colors can be defined. With the alpha channel the total number of possible colors become 4,294,967,296 (256 * 256 * 256 * 256).

>>> circle1.fillColor = (255, 0, 0, 150)
>>> polygon2.fillColor = color.navyblue

Transparency

When transparency is toggled off, the alpha value in the color definition becomes ineffective. Transparency can be toggled on or off from the menus or from the Python interpreter. Currently, running the models with the transparency option on is significantly slower than running the same model with no transparency due to the limitations of the underlying graphics libraries.

Fill style

Mekanimo uses the fill styles provided by the wx library as listed below.

  • TRANSPARENT Transparent (no fill).
  • SOLID Solid.
  • STIPPLE Uses a bitmap as a stipple.
  • BDIAGONAL_HATCH Backward diagonal hatch.
  • CROSSDIAG_HATCH Cross-diagonal hatch.
  • FDIAGONAL_HATCH Forward diagonal hatch.
  • CROSS_HATCH Cross hatch.
  • HORIZONTAL_HATCH Horizontal hatch.
  • VERTICAL_HATCH Vertical hatch.
fillstyles

Figure 1: Fill styles

>>> circle1.fillStyle = wx.CROSS_HATCH
>>> polygon2.fillColor = color.navyblue

Line color

Line color is specified as (red, green, blue, alpha) tuple. Red, green, blue, and alpha are specified as integers between 0 and 255. Without the alpha channel 16,777,216 (256 * 256 * 256) different colors can be defined. With the alpha channel the total number of possible colors become 4,294,967,296 (256 * 256 * 256 * 256).

>>> circle1.lineColor = (255, 0, 0, 150)
>>> polygon2.lineColor = color.navyblue

Transparency

When transparency is toggled off, the alpha value in the color definition becomes ineffective. Transparency can be toggled on or off from the menus or from the Python interpreter. Currently, running the models with the transparency option on is significantly slower than running the same model with no transparency due to the limitations of the underlying graphics libraries.

Line style

Mekanimo uses the line styles provided by the wx library as listed below.

  • SOLID
  • TRANSPARENT
  • DOT
  • LONG_DASH
  • SHORT_DASH
  • STIPPLE
  • USER_DASH
  • BDIAGONAL_HATCH
  • CROSSDIAG_HATCH
  • FDIAGONAL_HATCH
  • CROSS_HATCH
  • HORIZONTAL_HATCH
  • VERTICAL_HATCH
linestyles

Figure 2: Line styles

Line weight

Specifies the width of the border line. If set to zero then no line is drawn.

lineweights

Figure 3: Line weights

Label

Rigid bodies can display user specified labels.

>>> circle1.label = 'Target'
label

Figure 4: Label

Labels can be hidden by setting the showLabel attribute to False.

>>> circle1.showLabel = False

Font size

Font family

  • DEFAULT
  • SWISS
  • ROMAN
  • SCRIPT
  • MODERN
  • DECORATIVE
>>> circle1.labelFontFamily = SWISS

Font style

  • NORMAL
  • SLANT
  • ITALIC
>>> circle1.labelFontStyle = ITALIC

Font weight

  • NORMAL
  • LIGHT
  • BOLD
>>> circle1.labelFontWeight = BOLD

Offset

Label offset is specified for x and y direction in pixels. Positive Y direction is downwards.

>>> circle1.labelOffsetX = 20
>>> circle1.labelOffsetY = -20
labeloffset

Figure 5: Label offset (x = 20 pixels, y = -20 pixels)

Tag

Tags are element names and they are hidden by default.

>>> circle1.showTag = True
tag

Figure 5: Tag

Table Of Contents

Previous topic

Graphics

Next topic

Connector graphics

This Page