Public Member Functions | List of all members
ModalGroup Class Reference

Inherits ScriptObject.

Public Member Functions

 ModalGroup ()
 setStrict (Boolean strict)
 setAutoReset (Boolean autoreset)
 setLogUndefined (Boolean logundefined)
Integer getNumberOfGroups ()
Integer getNumberOfCodes ()
Integer getNumberOfCodesInGroup (Integer group)
Boolean isCodeDefined (Integer code)
Boolean isActiveCode (Integer code)
 makeActiveCode (Integer code)
Integer getActiveCode (Integer group)
Boolean hasActiveCode (Integer group)
 reset ()
Integer resetGroup (Integer group)
Integer createGroup ()
 removeCode (Integer code)
 addCode (Integer group, Integer code)
Boolean isGroup (Integer group)
Integer getGroup (Integer code)
Boolean inSameGroup (Integer a, Integer b)
Boolean isEnabled ()
 enable ()
 disable ()
 setForce (Boolean force)
 setFormatNumber (FormatNumber formatNumber)
 setPrefix (String prefix)
 setSuffix (String suffix)
String format (Integer code)

Detailed Description

A modal group.

Use createModalGroup() to construct the object.

var gFormat = createFormat({width:2, zeropad:true, decimals:0, prefix:"G"});
var gModal = createModalGroup(
{strict: false},
[[0, 1, 2, 3], interval(80, 89)], // motion
[20, 21], // unit
[90, 91] // absolute/relative
gModal.format(90); // returns "G90"
gModal.format(0); // returns "G00"
gModal.format(0); // returns ""
gModal.format(1); // returns "G01"
gModal.format(90); // returns ""
gModal.format(91); // returns "G91"
gModal.format(1); // returns ""

Constructor & Destructor Documentation

◆ ModalGroup()

Construct a new modal group.

Member Function Documentation

◆ addCode()

addCode ( Integer  group,
Integer  code 

Adds the specified code to the given group.

groupThe group.
codeThe code.

◆ createGroup()

Integer createGroup ( )

Creates a new group.

◆ disable()

disable ( )

Disables the output.

◆ enable()

enable ( )

Enables the output.

◆ format()

String format ( Integer  code)

Returns the formatted code.

Code must be defined in strict mode. If code is not defined in non-strict mode than the codes is output always.

◆ getActiveCode()

Integer getActiveCode ( Integer  group)

Returns the active code in the specified group.

◆ getGroup()

Integer getGroup ( Integer  code)

Returns the group id for the specified code.

Returns 0 if unknown id.

◆ getNumberOfCodes()

Integer getNumberOfCodes ( )

Returns the total number of defined codes.

◆ getNumberOfCodesInGroup()

Integer getNumberOfCodesInGroup ( Integer  group)

Returns the number of codes in the specified group.

◆ getNumberOfGroups()

Integer getNumberOfGroups ( )

Returns the number of groups.

◆ hasActiveCode()

Boolean hasActiveCode ( Integer  group)

Returns true if the specified group has an active code.

◆ inSameGroup()

Boolean inSameGroup ( Integer  a,
Integer  b 

Returns true if the specified codes are in the same group.

Returns false is either code is unknown.

◆ isActiveCode()

Boolean isActiveCode ( Integer  code)

Returns true if the specified code is active within its group.

◆ isCodeDefined()

Boolean isCodeDefined ( Integer  code)

Returns true if the specified code is defined.

◆ isEnabled()

Boolean isEnabled ( )

Returns true if enabled.

◆ isGroup()

Boolean isGroup ( Integer  group)

Returns true if the specified group is a valid group.

◆ makeActiveCode()

makeActiveCode ( Integer  code)

Marks the specified code as active within its group.

◆ removeCode()

removeCode ( Integer  code)

Removes the specified code.

codeThe code.

◆ reset()

reset ( )

Resets all groups.

◆ resetGroup()

Integer resetGroup ( Integer  group)

Resets the specified group.

groupThe group.
Returns the active code. Returns -1 if no code is active.

◆ setAutoReset()

setAutoReset ( Boolean  autoreset)

Sets the auto-reset mode. All groups are reset if an undefined code is output. Only appplies in non-strict mode.

◆ setForce()

setForce ( Boolean  force)

Sets the force mode.

◆ setFormatNumber()

setFormatNumber ( FormatNumber  formatNumber)

Sets the format.

◆ setLogUndefined()

setLogUndefined ( Boolean  logundefined)

Enables output of for use of undefined codes. Only on the first usage.

◆ setPrefix()

setPrefix ( String  prefix)

Sets the prefix.

◆ setStrict()

setStrict ( Boolean  strict)

Sets the strict mode.

◆ setSuffix()

setSuffix ( String  suffix)

Sets the suffix.

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