Your Ad Here

Go to: Synopsis. Return value. MEL examples.

Synopsis

constrainValue <float> <float> <float> <float>

constrainValue is undoable, queryable, and editable.

Returns a floating point value which is an integer multiple of the third argument that falls in the range between the given start and end values.

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.

Return value


float

MEL examples

// 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 //

  

Return to Autodesk Index


Your Ad Here
減重