|
Variable Modality and Set Status
Every GPP variable can be defined as modal or non-modal. In GPP2, the default modality is non-modal for all variables. The variable modality can be modified by statements in the GPP program declaration part.
Variables are typically defined as modal when they need to be output to the G-code file, but only if they are set on. The perfect example is X_CURPOS, which only needs to be output it is assigned a new value (and hence set on). With GPP2, only a few variables need to be defined as modal.
All Array members share the same modality, which is defined for the whole array.
The only difference between modal and non-modal variables is how they are affected by OUTPUT and PRINT commands. More specifically, the difference relates to their set status - that needs some explanation.
In GPP, each variable has a special status flag, signaling of the variable is set on or off. It is primarily used to identify system variables that are actually assigned new values by GPP when a block is processed. However, user-defined variables also have the same status set flag, and behave the same way.
In arrays, each array member has a separate set flag. Therefore, some array members may be on, while others may be off.
The set status flag can be tested in program control statements (such as IF, IF_SET and REPEAT UNTIL), so that different actions can be taken based on any variable status.
In GPP2, the set status flag dose not affect how variables are printed in OUTPUT & PRINT statements. A variable will be printed even if it is in set off status.
A variable is set on in one of the following cases:
-
The first time it is assigned a value.
-
It is set on by GPP2 when it needs to be output as part of the G-Code. The exact condition depends on the variable, the toolpath block, and internal GPP2 logic.
-
-
Some variables, such as X_CURPOS, are set on when they are assigned a new value, different than the previous value it had before. For numeric variables, different takes into consideration the variable format - values are considered different only if they appear different when sent to OUTPUT.
-
Other variables, such as PART_TOL, are set on when they are included in the toolpath (for example, in a given procedure) and off when they are not - regardless of their previous value (being equal to the new value or not).
-
-
It is explicitly turned on with the SET_ON command (see later).
-
An identical variable is turned on (identical variables always have the same set status). See below regarding identical variables.
A variable is turned off in one of the following cases:
-
A modal variable is printed with an OUTPUT or PRINT statement. Non-modal variables are not affected by these statements (and will remain on).
-
The variable is explicitly turned off with the SET_OFF command (see later).
-
An identical variable is turned off (identical variables always have the same set status).
Once again, the only difference between modal and non-modal variables is how they react to OUTPUT statements. Modal variables are turned off, while non-modal variables are not.
GPP Compatibility Notes:
In the old GPP manual, it is stated that non-modal variables are never turned off. This is not accurate - they are not turned off by the OUTPUT statement, but they can be turned off in other ways (For example, with the SET_OFF command).
In old GPP, members of modal arrays do not respond to the OUTPUT statement. They remain set on. In GPP2, they are turned "off", like any modal variable.
In old GPP, the default modality for each variable was taken from its format. In GPP2, formats do not have modality anymore, and all variables are non-modal by default, unless explicitly declared as modal.
|