Custom colors in 2D visualization

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Custom colors in 2D visualization

Post by MarvinH »

In case you want to use some other colors than the default colors in your 2D visualization, try to add some of the following to your On2DDraw event:

Code: Select all

Do(
  Var([valSolid], vbValue, 1),
  Var([valBlinking], vbValue, 0),
  Var([valDisco], vbValue, 0),
  Var([valPeriod], vbValue, 300),
  Var([valBase], vbValue, ColorLime),
  
  Case(
    WhichIsTrue(
      valSolid,
      valBlinking,
      valDisco
    ),
    { * Solid * }
    Color(c) := ColorBlack,
    { * Blinking * }
    If(
      Sin(valPeriod * Now) > 0,
      Color(c) := ColorBlack,
      Color(c) := ColorWhite
    ),
    { * Disco * }
    Color(c) := valBase * Sin(valPeriod * Now)
  )
)
By playing with the first 5 parameters, the color of your visualization will change. Note that the colors in ED are stored as integer values. For example ColorBlack equals 0, ColorRed equals 255 and ColorLime equals 65280. Try some values your own, and enjoy!
Post Reply