Math Operations

This function block performs arithmetic on a selectable number of numeric inputs. Use it to combine measurements, compute ratios, totals, products or differences in simple visual workflows β€” no programming required.

πŸ“₯ Inputs

Number One or more numeric input sockets. The block starts with two numeric inputs by default and can be expanded up to 20 inputs using the control below.

Note: Unconnected input sockets are ignored when the block runs. Only connected numeric values are used in the calculation.

πŸ“€ Outputs

Number The numeric result of the selected arithmetic operation applied to the provided inputs.

πŸ•ΉοΈ Controls

Input size Choose how many numeric input sockets are available (2–20). The block will add or remove input sockets to match this setting.

Select a method Choose the arithmetic method to apply across provided inputs. Available methods: ADD, SUBTRACT, MULTIPLY, DIVIDE.

βš™οΈ Running mechanism

  • The block reads all connected numeric inputs when it runs.

  • It applies the chosen method across those values:

    • ADD: sums all inputs.

    • SUBTRACT: subtracts the sum of all following inputs from the first input.

    • MULTIPLY: multiplies all inputs together.

    • DIVIDE: performs sequential division starting from the first input by each following input.

  • The computed single numeric result is presented on the output socket.

This block skips empty/unconnected sockets automatically so you can change how many inputs to use without reconfiguring connections.

🎯 Features

  • Expandable input count (2–20) for flexible calculations.

  • Simple UI controls to switch arithmetic method instantly.

  • Ignores unconnected inputs to avoid errors when wiring dynamic systems.

  • Designed for visual assembly with other measurement and logic blocks.

πŸ“ Usage guide

  1. Set Input size to the number of values you want to combine.

  2. Connect numeric-producing blocks (sensors, counters, measurement outputs, manual inputs) to the numeric input sockets.

  3. Choose the desired operation with Select a method.

  4. Read the result from the output Number and feed it into downstream blocks (logging, thresholds, or actuators).

πŸ’‘ Tips and Tricks

  • Combine with Number Input when you need a manual value to be part of the calculation (for offsets or thresholds).

  • Use with Counter or Get Batch Size to compute averages, rates, or ratios from counted values.

  • Feed outputs from measurement blocks like Measure Position Distance or Image Resolution and Channel Value into this block to derive derived metrics (e.g., distance per pixel, normalized sizes).

  • After a math operation, use Round or Absolute to format the result before display or logging.

  • To compute element-wise or aggregated values from lists, pair with Get Element or batch-control blocks to extract individual numbers first.

πŸ› οΈ Troubleshooting

  • If the output is unexpected, check that all required inputs are connected and contain numeric values (use Number Input or debug blocks to verify).

  • For division, ensure none of the divisor inputs are zero to avoid invalid results.

  • If you change Input size and get unexpected wiring, re-check connections β€” adding/removing sockets may shift input order.

Use this block to keep arithmetic simple and visual when building measurement or decision pipelines.

Last updated

Was this helpful?