Draw a Scale Pointer in EEZ Studio Using These Steps

To draw a scale pointer (needle) in EEZ Studio, use the Line or Polygon tool to create a triangular shape, then rotate it dynamically via bindings to reflect real-time values. Adjust pivot points, styling (color/width), and angle properties for precision. Bind the rotation to a variable or channel for interactive behavior.

Prerequisites

  • EEZ Studio installed with a new or existing SCPI instrument project.
  • A gauge widget (e.g., circular scale) already placed on the frontend panel.
  • Basic understanding of bindings and variables in EEZ Studio.

Step-by-Step Guide

1. Add the Pointer Shape

  1. Select the Polygon tool from the toolbar (or use the Line tool for a simpler needle).
  2. Draw a triangle:
    • Start at the pivot point (center of the gauge).
    • Extend a line outward for the needle's length (e.g., 80% of the gauge radius).
    • Add two short lines to form a triangular tip (width ~5-10% of the gauge radius).
    • Close the shape by connecting back to the pivot.
  3. Set Fill to transparent and Border to a contrasting color (e.g., red).

2. Configure the Pivot Point

  • Select the pointer shape and open the Properties panel.
  • Under Transform, set:
    • Origin: Center (or manually adjust X/Y to match the gauge center).
    • Rotation: 0° (initial position, typically pointing upward at 12 o'clock).

3. Bind the Rotation to a Variable

  1. Create a variable (e.g., `needleAngle`) in the Variables tab to store the angle.
  2. Right-click the pointer shape → Bind → Rotation Angle.
  3. Link it to your variable (e.g., `{needleAngle}`) or directly to a channel value with a formula:
    ({channelValue} / {maxValue})  {maxAngle}
    Example: `({voltage} / 10) 180` for a 0-10V range spanning 180°.>

4. Calibrate the Scale

  • Ensure the minimum/maximum angles align with your gauge's scale (e.g., -90° to +90° for a semicircular gauge).
  • Test by manually adjusting the bound variable or simulating input data.

Comparison of Pointer Creation Methods

Method Complexity Customization Performance Best For
Polygon Tool Medium High (custom shapes, gradients) Good Precise, styled needles
Line Tool Low Low (basic lines only) Best Simple, fast needles
SVG Import High Very High (pre-designed graphics) Medium Complex or branded pointers

Pro Tips for Realistic Pointers

  • Add a hub: Place a small circle at the pivot point to mimic a screw or cap.
  • Shadow effect: Duplicate the pointer, set it to gray, and offset slightly for depth.
  • Smooth movement: Use the `smooth()` function in bindings to reduce jitter:
    smooth({rawValue}, 0.2)
  • Dynamic color: Bind the pointer color to a variable (e.g., turn red if value exceeds a threshold).

Troubleshooting

Pointer Not Rotating?

  • Check if the variable/channel has valid data.
  • Verify the binding syntax (e.g., curly braces `{ }` are required).
  • Ensure the origin point is correctly set to the gauge center.

Pointer Misaligned?

  • Adjust the initial rotation angle (e.g., -120° for a gauge starting at 7 o'clock).
  • Recalculate the angle formula to match your scale range.