Formatting Post Variable Output

Introduction

This topic explains the syntax used with a post variable (in the post processor) to define the output format of that variable in the NC program (G-code). While there are formatting blocks, or post questions, in the post processor that define the general output and/or the output for groups of items, the information in this topic is used to format a specific variable.

Variable Formatting

The output format of posting variables can be controlled using a special formatting string (or format specifier). The format specifier controls the number of leading and/or trailing digits to use and whether or not a decimal point is used. The format specifier is placed before the variable in the post processor. The output of the variable in the posted NC program is shown in the following example.

Example Usage

'[5.4L]'post_variable_name

 

The following examples show the output of a variable with a value of 9.15

 

Formatting String Output

'[5.4L]'

00009.1500

'[5.1L]'

00009.1

'[4.L]'

0009.15

'[3L]'

009

'[.4T]'

9.1500

'[5T]'

915000

'[.1T]'

9.1

'[1T]'

91

 

Summary and Important Notes

The single quotes must be used as a part of the formatting string.

 

Notice the first example, '[5.4L]', outputs the value with five digits before the decimal place (leading) and four digits after the decimal place (trailing).

 

The capital letter, L, must be used to specify the first value as the leading digits used (or if using only a single number in the string). The letter is always placed at the end of the formatting string.

 

The capital letter, T, is used to when specifying (only) the trailing digits used.

 

If no decimal point is used in the formatting string, the decimal is not used in the resulting output. (Notice the output of the examples that don't use the decimal point.)