OUTPUT

The OUTPUT statement writes text to the output G-code file. This is the way to generate the post-processor output machine program.

OUTPUT argument1 argument2 ...

The arguments of the OUTPUT statement are special entities in GPP2, and regular expressions cannot be used. The arguments may be one of the following:

The new-line character (For example, $): this argument may only be used if the GPP program contains a NEW_LINE_IS section where the new-line character has been defined. The OUTPUT argument must match the character used in that earlier definition.

In response to the new-line character in the OUTPUT statement, GPP2 will execute the statements listed in the NEW_LINE_IS block. The mechanism is similar to a procedure call each time the new-line character is encountered. All real output is expected to take place in the NEW_LINE_IS block itself.

Strings: any constant string may be used

Variables: GPP2 will format the variable according to its format, and convert it to a string. For string variables, the formatted output is simply the variable contents. For numeric variables, the formatted string depends on the DF2 file definitions, as explained earlier.

Any type of GPP variable may be used (system user or interaction). Array members may also be used, but not full arrays.

Using non-initialized variables does not generate any output and creates a runtime warning.

With GPP2, it is possible to output a variable regardless of it set status. The same result will be created if the variable is set on or off.

Many times, the PP program tests the status flag before outputting a variable. For instance, a common line will be:

IF_SET (X_CURPOS) OUTPUT " X" X_CURPOS; END_IF;

The IF_SET statement ensures that no output is generated if X_CURPOS is not set. This, of course, includes the " X" string.

If, however, the GPP developer wishes to output a variable value regardless of its set status, he or she can do so easily without using the SET_ON statement first.

For instance, consider the following code after a tool change:

SET_ON SPIN_SPEED SPIN_DIR            // Not needed in GPP2!

OUTPUT $ " S" SPIN_SPEED " " SPIN_DIR; // output guaranteed!

The OUTPUT line will turn the spindle on regardless of the set values of the parameters.

Modal variables are set "off" after being output (if they were "on" before).

GPP Compatibility Notes:

In the old GPP, variables that were set "off" did not generate any output when used in the OUTPUT statement. This behavior was changed in GPP2. A variable is formatted and output regardless of its set status flag!

The special TAB_ keyword: instructs GPP2 to insert space characters until the next tab position. Tab positions can be defined with the SET_TABS statement. In case the output file is already positioned on a tab position, GPP2 will insert spaces until the next tab position.

Control characters (\A to \Z): GPP2 will output the corresponding ASCII character to the output file (1 for \A, up to 26 for \Z). Also, \+ may be used to indicate the new-line character (same as \J).

In addition, any ASCII character can be output by using the \ddd format, where ddd is the ASCII value of the character. That format may be used to output non-standard characters that do not fall between ASCII 1 to 26 (For example, \250). The number must be no higher than 255.

GPP2 has a special treatment to the new-line control character (\J or \+). It will only output it if the current file line already contains some other characters. Otherwise, the new-line character will be suppressed. That way, no empty lines are ever generated in the output G-code file. At the end of the file, if the last line is not terminated with a new-line character, GPP2 will automatically add it.

Example

OUTPUT "X" X_CURPOS $;

OUTPUT TAB_ "A" TAB_ "B" \J;

OUTPUT $ LIN_MOV $;

Suppose the tabs were set as follows with the SET_TABS statement:

SET_TABS 4 8 12 16;      // tabs every 4 positions

Now, suppose the GPP program executes the following statements:

  OUTPUT \J "12345678901234567890";
  OUTPUT \J TAB_ "A" TAB_ "B" TAB_ "C" TAB_ "D";
  OUTPUT \J "*" TAB_ "A";
  OUTPUT \J "***" TAB_ "A";
  OUTPUT \J TAB_ TAB_ TAB_ TAB_ "D";

The output file will look as follows:

12345678901234567890

   A   B   C   D

*  A

***A

               D

Some functionality may be dependent on the product package. Contact your Reseller if you require a license.