Go to: Synopsis. Return value. MEL examples.

```
constrainValue
float float float float
```

constrainValue is undoable, **NOT queryable**, and **NOT editable**.

The first argument represents the start value of a range.

The second argument represents the end value of a range.

The third argument represents a multiple used to compute the constrained value.

The fourth and final argument represents the value being constrained.

float | Command result |

// All the the examples use a range from 3.0 to 9.0, and a by value of 1.5. // // 0.0 is less than the start value (3.0), so the value is clamped to 3.0. // constrainValue 3.0 9.0 1.5 0.0; // Result: 3 // // 12.0 is greater than the end value (9.0), so it gets clamped to 9.0 // constrainValue 3.0 9.0 1.5 12.0; // Result: 9 // // For a value of 8.0, The answer is ( 3.0 + ( 1.5 * 3 ) ) which is to say // it is ( start + ( by * n ) ) where n is an integer. // constrainValue 3.0 9.0 1.5 8.0; // Result: 7.5 // // The answer is ( 3.0 + ( 1.5 * 2 ) ), which is less than 7.0 // constrainValue 3.0 9.0 1.5 7.0; // Result: 6 //