Scaling & clamping
The input/output offsets, scale factor and min/max applied to every variable mode.
Every variable, whatever its mode, passes its result through the same modifier pipeline:
raw = mode result (constant, function, cam, PLC read…)
value = scaleFactor · (raw + inputOffset) + outputOffset
value = clamp(value, min, max) // if min/max are set| Modifier | Use |
|---|---|
| Input offset | Shift before scaling, zero-point corrections |
| Scale factor | Unit conversion and inversion |
| Output offset | Shift after scaling, mounting positions, home offsets |
| Min / max | Clamp the final value |
Where this earns its keep
Unit conversion at the boundary. PLC values arrive in controller units, encoder counts, µm, 0.1° increments. Convert them on the variable (scaleFactor = 360/4096 for a 12-bit encoder to degrees) so everything downstream works in scene units. Keep the conversion in exactly one place.
Direction inversion. scaleFactor = -1 when the twin's axis runs opposite to the machine's positive direction.
Safety clamps. Set min/max to the physical travel of the axis. If a PLC value glitches or a function overshoots, the twin stops at the end of travel instead of tearing the machine apart visually, and mechanisms with limited feasible ranges never receive impossible inputs.
Home offsets. The machine's zero rarely coincides with your scene's zero, outputOffset reconciles them without touching the CAD or the object pose.