Outputting text formatted with FN 16: F-PRINT
Application
With the FN 16: F-PRINT function you can output formatted fixed and variable texts (e.g., in order to save measuring logs).
You can output the values as follows:
- Save them to a file on the control
- Display them in a window on the screen
- Save them to a file on an external drive or USB device
- Print them to a connected printer
Related topics
- Automatically generated measurement log for touch probe cycles
- Print to a connected printer
Description of function
In order to output fixed or variable numbers and texts, the following is required:
- Format file
The format file determines the contents and formatting.
- NC function FN 16: F-PRINT
The control creates the output file using the NC function FN 16.
The maximum size of the output file is 20 kB.
Format file for contents and formatting
The control creates the output file in the following cases:
- End of program END PGM
- Cancellation of program with the NC STOP key
- M_CLOSE keyword in the format file
Format file for contents and formatting
Define the formatting and the contents of the output file in a format file with the extension *.a.
Formatting
The formatting of the source file can be defined with the following formatting characters:
Please note that the input is case-sensitive.
Formatting characters | Meaning |
---|---|
“...“ | Identify the formatting of the contents to be output Tip For text output, you can use the UTF-8 character set. |
%F, %D or %I | Initiate the formatted output of numerical parameters
|
9.3 | Define the number of digits for the output of numerical values
|
%S or %RS | Initiate the formatted or unformatted output of a string parameter
|
, | Separate the input within a format-file line (e.g., data type and variable) |
; | End of the format-file line |
* | Initiate a comment line within the format file Comments are not included in the output file |
%" | Output quotation marks in the output file |
%% | Output a percentage sign in the output file |
\\ | Output a backslash in the output file |
\n | Output a line break in the output file |
+ | Output the variable value right-aligned in the output file |
- | Output the variable value left-aligned in the output file |
Keywords
You can define the contents of the output file with the following keywords:
Keyword | Meaning |
---|---|
CALL_PATH | Output the path name of the NC program that contains the FN 16 function (e.g., "TouchProbe: %S",CALL_PATH;) |
M_CLOSE | Close the file written to with FN 16 |
M_APPEND | Upon renewed output, append the contents of the output file to the existing output file |
M_APPEND_MAX | Upon renewed output, append the contents of the output file to the existing output file until the maximum file size of 20 kB is reached (e.g., M_APPEND_MAX20;) |
M_TRUNCATE | Upon renewed output, overwrite the output file |
M_EMPTY_HIDE | Do not output blank lines for undefined or empty QS parameters in the output file |
M_EMPTY_SHOW | Output blank lines for undefined or empty QS parameters and reset M_EMPTY_HIDE |
L_ENGLISH | Outputs text only for English conversational language |
L_GERMAN | Outputs text only for German conversational language |
L_CZECH | Outputs text only for Czech conversational language |
L_FRENCH | Outputs text only for French conversational language |
L_ITALIAN | Outputs text only for Italian conversational language |
L_SPANISH | Outputs text only for Spanish conversational language |
L_PORTUGUE | Outputs text only for Portuguese conversational language |
L_SWEDISH | Outputs text only for Swedish conversational language |
L_DANISH | Outputs text only for Danish conversational language |
L_FINNISH | Outputs text only for Finnish conversational language |
L_DUTCH | Outputs text only for Dutch conversational language |
L_POLISH | Outputs text only for Polish conversational language |
L_HUNGARIA | Outputs text only for Hungarian conversational language |
L_JAPANESE | Output text only for Japanese conversational language |
L_RUSSIAN | Outputs text only for Russian conversational language |
L_CHINESE | Outputs text only for Chinese conversational language |
L_CHINESE_TRAD | Outputs text only for Chinese (traditional) conversational language |
L_SLOVENIAN | Outputs text only for Slovenian conversational language |
L_KOREAN | Outputs text only for Korean conversational language |
L_NORWEGIAN | Outputs text only for Norwegian conversational language |
L_ROMANIAN | Outputs text only for Romanian conversational language |
L_SLOVAK | Outputs text only for Slovakian conversational language |
L_TURKISH | Outputs text only for Turkish conversational language |
L_ALL | Display text independently of the conversational language |
HOUR | Output the hours of the current time |
MIN | Output the minutes of the current time |
SEC | Output the seconds of the current time |
DAY | Output the day of the current date |
MONTH | Output the month of the current date |
STR_MONTH | Output the month of the current date in short form |
YEAR2 | Output the year of the current date in two-digit format |
YEAR4 | Output the year of the current date in four-digit format |
Input
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 FN 16: F-PRINT TNC:\mask.a / TNC:\Prot1.txt | ; Output file Prot1.txt with the source from Mask.a |
To navigate to this function:
Insert NC function FN Special functions FN 16 F-PRINT
The NC function includes the following syntax elements:
Syntax element | Meaning |
---|---|
FN 16: F-PRINT | Syntax initiator for formatted output of contents |
File | Path of the format file for the output format Fixed or variable path Selection by means of a selection window |
/ | Separator between the two paths |
File | Path under which the control saves the output file Fixed or variable path Selection by means of a selection window The file name extension of the log file determines the file type of the output (e.g., TXT, A, XLS, HTML). |
If you want to define variable paths, use the following syntax to enter the QS parameters:
Syntax element | Meaning |
---|---|
:'QS1' | Enter QS parameters with a preceding colon and between single quotation marks |
:'QL3'.txt | Specify the file name extension of the target file, if required |
Output options
Screen output
You can use the FN 16 function to display messages in a window on the control screen. This allows you to display explanatory texts in such a way that the user cannot continue without reacting to them. The contents of the output text and the position in the NC program can be chosen freely. You can also output variable values.
In order to display the message on the control screen, enter SCREEN: as the output path.
The message is also displayed on the FN 16 tab of the Status workspace.
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 FN 16: F-PRINT TNC:\MASKE \MASKE1.A / SCREEN: | ; Display the output file with FN 16 on the control screen |
If you want to replace the content of the window for multiple screen outputs in the NC program, define the M_CLOSE or M_TRUNCATE keyword.
The control opens the FN16-PRINT window for screen output. The window remains open until you close it. While the window is open, you can operate the control in the background and change to another operating mode.
You can close the window in the following ways:
- Define the SCLR: output path (Screen Clear)
- Select the OK button
- Select the Reset program button
- Select a new NC program
Saving the output file
With the FN 16 function, you can save the output files to a drive or a USB device.
To save the output file, define the path including the drive in the FN 16 function.
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 FN 16: F-PRINT TNC:\MSK\MSK1.A / PC325:\LOG\PRO1.TXT | ; Save output file with FN 16 |
If you program the same output multiple times in the NC program, the control appends the current output to the end of the contents already output within the target file.
Printing the output file
You can use the FN 16 function to print output files to a connected printer.
The control will only print the output file if the format file ends with the M_CLOSE keyword.
To use the default printer, enter Printer:\ as the target path and a file name.
If you do not use the default printer, enter the path to the respective printer (e.g., Printer:\PR0739\) and a file name.
The control saves the file using the defined file name and the defined path. The control will not print the file name.
The control saves the file temporarily until printing is complete.
Notes
- Use the optional machine parameters fn16DefaultPath (no. 102202) and fn16DefaultPathSim (no. 102203) to define a path under which the control saves the output files.
If you define a path both in the machine parameters and in the FN 16 function, the path in the FN 16 function has priority.
- If you only define the file name as the target path of the output file in the FN function, the control saves the output file in the folder of the NC program.
- If the called file is located in the same directory as the file you are calling it from, you can also enter just the file name without the path. If you select the file using the selection menu, the control automatically proceeds in this manner.
- If you specify the %RS function in the format file, the control takes over the defined content without formatting. This allows you to output a path specification with QS parameters, for example.
- In the settings of the Program workspace, you can specify whether the control displays a screen output in a window.
If you deactivate the screen output, the control will not display a window. The control will display the contents anyway on the FN 16 tab of the Status workspace.
Example
Example of a format file that generates an output file with variable contents:
“TOUCHPROBE“;
“%S“,QS1;
M_EMPTY_HIDE;
“%S“,QS2;
“%S“,QS3;
M_EMPTY_SHOW;
“%S“,QS4;
"DATE: %02d.%02d.%04d",DAY,MONTH,YEAR4;
"TIME: %02d:%02d",HOUR,MIN;
M_CLOSE;
Example of an NC program that defines only QS3:
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
11 Q1 = 100 | ; Assign the value 100 to Q1 |
12 QS3 = "Pos 1: " || TOCHAR( DAT+Q1 ) | ; Convert the numerical value of Q1 to a text and assign it to the defined character string |
13 FN 16: F-PRINT TNC:\fn16.a / SCREEN: | ; Display the output file with FN 16 on the control screen |
Example of a screen output with two empty lines resulting from QS1 and QS4:
- The FN16-PRINT window