Public Member Functions | List of all members
OutputVariable Class Reference

Public Member Functions

 OutputVariable (Map specifiers, Format format)
 
 disable ()
 
 enable ()
 
String format (Number value)
 
Value getControl ()
 
Value getCurrent ()
 
Value getCyclicLimit ()
 
Value getCyclicSign ()
 
FormatNumber getFormat ()
 
Value getPrefix ()
 
Value getResultingValue ()
 
Value getSuffix ()
 
Value getTolerance ()
 
Value getType ()
 
Boolean isEnabled ()
 
 setControl (Value control)
 
 setCurrent (Value current)
 
 setCyclicLimit (Value cyclicLimit)
 
 setCyclicSign (Value cyclicLimit)
 
 setFormat (format)
 
 setPrefix (Value prefix)
 
 setSuffix (Value suffix)
 
 setTolerance (Value tolerance)
 
 setType (Value type)
 
 reset ()
 
String getDecimalSymbol ()
 
 setDecimalSymbol (String decimalSymbol)
 
Boolean getForceSign ()
 
 setForceSign (Boolean forceSign)
 
Value getNumberOfDecimals ()
 
 setNumberOfDecimals (Value numberOfDecimals)
 
Value getScale ()
 
 setScale (Value scale)
 
Value getOffset ()
 
 setOffset (Value offset)
 
Value getBase ()
 
 setBase (Value base)
 
Value getMinimum ()
 
 setMinimum (Value minimum)
 
Value getMaximum ()
 
 setMaximum (Value maximum)
 
Value getMinDigitsLeft ()
 
 setMinDigitsLeft (Value minDigitsLeft)
 
Value getMinDigitsRight ()
 
 setMinDigitsRight (Value minDigitsRight)
 
Value getFormatType ()
 
 setFormatType (Value type)
 

Detailed Description

A formatting variable. Instances of this class are used to format incoming values. Supports absolute, incremental, and directional variables. State is maintained to avoid output for unchanged values.

Since
r45884
var xFormat = createFormat({decimals:3, trim:false});
var xVariable = createOutputVariable({type:TYPE_ABSOLUTE, prefix:"X"}, xFormat);
var str = xVariable.format(4.4); // returns "X4.400"
str = xVariable.format(4.4); // returns ""
str = xVariable.format(7); // returns "X7.000"

Constructor & Destructor Documentation

◆ OutputVariable()

OutputVariable ( Map  specifiers,
Format  format 
)

Constructs an output variable.

Parameters
specifiersThe specifiers.
formatThe desired format.

The supported specifiers are:

  1. control: Determines when a formatted variable will be output and can be CONTROL_CHANGED, CONTROL_FORCE, or CONTROL_NONZERO.
  2. current: Specifies that initial value to store in the output variable.
  3. cyclicLimit: Specifies the absolute range limit for the formatted value, for example 360 for a rotary axis.
  4. cyclicSign: Specifies the sign for a cyclic value and can be -1 (negative), 0 (both), or 1 (positive).
  5. onchange: Defines a function to be called when the formatted value has changed.
  6. prefix: Specifies a prefix to be prepended to the formatted value.
  7. suffix: Specifies a suffix to be appended to the formatted value.
  8. tolerance: A value must differ from the previous value by greater than tolerance to be output.
  9. type: Specifies the variable type and can be TYPE_ABSOLUTE, TYPE_INCREMENTAL, or TYPE_DIRECTIONAL.
Since
r45877

Member Function Documentation

◆ disable()

disable ( )

Disable the variable from being output. When invoked format() always returns an empty string.

◆ enable()

enable ( )

Enables the variable for output.

◆ format()

String format ( Number  value)

Returns the formatted string of the specified value. An empty string can be returned based on the control setting.

◆ getBase()

Value getBase ( )

Returns the base number of the FormatNumber associated with the OutputVariable.

◆ getControl()

Value getControl ( )

Returns the output control.

◆ getCurrent()

Value getCurrent ( )

Returns the last formatted value.

◆ getCyclicLimit()

Value getCyclicLimit ( )

Returns the cyclic limit.

◆ getCyclicSign()

Value getCyclicSign ( )

Returns the cyclic sign.

◆ getDecimalSymbol()

String getDecimalSymbol ( )

Returns the decimal separator of the FormatNumber associated with the OutputVariable.

◆ getForceSign()

Boolean getForceSign ( )

Returns the force sign flag of the FormatNumber associated with the OutputVariable.

◆ getFormat()

FormatNumber getFormat ( )

Returns the format attached to the variable.

◆ getFormatType()

Value getFormatType ( )

Returns the type of formatted value of the FormatNumber associated with the OutputVariable.

◆ getMaximum()

Value getMaximum ( )

Returns the maximum allowed value of the FormatNumber associated with the OutputVariable.

◆ getMinDigitsLeft()

Value getMinDigitsLeft ( )

Returns the minimum number of digits to the left of the decimal point of the FormatNumber associated with the OutputVariable.

◆ getMinDigitsRight()

Value getMinDigitsRight ( )

Returns the minimum number of digits to the right of the decimal point of the FormatNumber associated with the OutputVariable.

◆ getMinimum()

Value getMinimum ( )

Returns the minimum allowed value of the FormatNumber associated with the OutputVariable.

◆ getNumberOfDecimals()

Value getNumberOfDecimals ( )

Returns the number of decimals of the FormatNumber associated with the OutputVariable.

◆ getOffset()

Value getOffset ( )

Returns the offset of the FormatNumber associated with the OutputVariable.

◆ getPrefix()

Value getPrefix ( )

Returns the prefix.

◆ getResultingValue()

Value getResultingValue ( )

Returns the resulting value as if it was formatted for the variable.

◆ getScale()

Value getScale ( )

Returns the scale of the FormatNumber associated with the OutputVariable.

◆ getSuffix()

Value getSuffix ( )

Returns the suffix.

◆ getTolerance()

Value getTolerance ( )

Returns the output tolerance for the variable.

◆ getType()

Value getType ( )

Returns the type.

◆ isEnabled()

Boolean isEnabled ( )

Returns true if the variable is enabled.

◆ reset()

reset ( )

Invoke to force output of value on the next invocation of format(). reset() has no effect if control has been set to force for the given format.

◆ setBase()

setBase ( Value  base)

Sets the base number of the FormatNumber associated with the OutputVariable.

◆ setControl()

setControl ( Value  control)

Sets the variable output control. Can be CONTROL_CHANGED, CONTROL_FORCE, or CONTROL_NONZERO.

◆ setCurrent()

setCurrent ( Value  current)

Sets the current value for the variable.

◆ setCyclicLimit()

setCyclicLimit ( Value  cyclicLimit)

Sets the cyclic limit.

◆ setCyclicSign()

setCyclicSign ( Value  cyclicLimit)

Sets the cyclic sign. Can be -1, 0, 1.

◆ setDecimalSymbol()

setDecimalSymbol ( String  decimalSymbol)

Sets the decimal separator of the FormatNumber associated with the OutputVariable..

◆ setForceSign()

setForceSign ( Boolean  forceSign)

Sets the force sign flag of the FormatNumber associated with the OutputVariable.

◆ setFormat()

setFormat ( format  )

Assigns a format to the variable.

◆ setFormatType()

setFormatType ( Value  type)

Sets the type of formatted value of the FormatNumber associated with the OutputVariable.

◆ setMaximum()

setMaximum ( Value  maximum)

Sets the maximum allowed value of the FormatNumber associated with the OutputVariable.

◆ setMinDigitsLeft()

setMinDigitsLeft ( Value  minDigitsLeft)

Sets the minimum number of digits to the left of the decimal point of the FormatNumber associated with the OutputVariable.

◆ setMinDigitsRight()

setMinDigitsRight ( Value  minDigitsRight)

Sets the minimum number of digits to the right of the decimal point of the FormatNumber associated with the OutputVariable.

◆ setMinimum()

setMinimum ( Value  minimum)

Sets the minimum allowed value of the FormatNumber associated with the OutputVariable.

◆ setNumberOfDecimals()

setNumberOfDecimals ( Value  numberOfDecimals)

Sets the number of decimals of the FormatNumber associated with the OutputVariable.

◆ setOffset()

setOffset ( Value  offset)

Sets the offset of the FormatNumber associated with the OutputVariable.

◆ setPrefix()

setPrefix ( Value  prefix)

Sets the prefix.

◆ setScale()

setScale ( Value  scale)

Sets the scale of the FormatNumber associated with the OutputVariable.

◆ setSuffix()

setSuffix ( Value  suffix)

Sets the suffix.

◆ setTolerance()

setTolerance ( Value  tolerance)

Sets the output tolerance for the variable.

◆ setType()

setType ( Value  type)

Sets the variable type. Can be TYPE_ABSOLUTE, TYPE_INCREMENTAL, or TYPE_DIRECTIONAL.



Generated by Autodesk, Inc. 05 April 2024
Copyright (c) 2012-2024 by Autodesk, Inc.