With QS parameters, you can define and further process texts, e.g. to create variable logs with FN 16: F-PRINT.
Description of function
You can assign a maximum of 255 characters to a QS parameter.
- The following characters are allowed within QS parameters:
- Characters
- Numbers
- Special characters, for example ?
- Control characters, for example \ for paths
- Spaces
The individual string functions are programmed using the free syntax input.
You can further process or check the values of QS parameters with the functions Formula Q/QL/QR and String Formula QS.
Syntax | Function | Higher-level NC function |
---|---|---|
DECLARE STRING | Assigning a value to QS parameter | |
STRING FORMULA | Linking QS parameters | String formula QS |
TONUMB | Converting the alphanumeric value of a QS parameter to a numeric value and assign it to a variable | Formula Q/QL/QR |
TOCHAR | Converting the numeric value to an alphanumeric value and assign it to a QS parameter | String formula QS |
SUBSTR | Copying a substring from a QS parameter | String formula QS |
SYSSTR | Read system data | String formula QS |
INSTR | Checking if the content of one QS parameter is contained in another QS parameter. Searching for a substring within the content of a QS parameter | Formula Q/QL/QR |
STRLEN | Determining the text length of the value of a QS parameter Determining the total number of characters in a QS parameter Tip If the selected string parameter is not defined the control returns the result -1. | Formula Q/QL/QR |
STRCOMP | Compare alphabetic priority Comparing the alphabetical order of two QS parameter contents | Formula Q/QL/QR |
CFGREAD | Read out machine parameter |
|
Read system data with SYSSTR
With the function SYSSTR you can read system data and store them in string parameters. You select the system data through a group number (ID) and a number.
Entering IDX and DAT is not required.
You can read the following system data:
Group name, ID no. | Number | Meaning |
---|---|---|
Program information, 10010 | 1 | Path of the current main program or pallet program |
2 | Path of the NC program shown in the block display | |
3 | Path of the cycle selected with CYCL DEF 12 PGM CALL | |
10 | Path of the NC program selected with SEL PGM | |
Channel data, 10025 | 1 | Channel name |
Values programmed in the tool call, 10060 | 1 | Tool name |
Kinematics, 10290 | 10 | Kinematics programmed in the last FUNCTION MODE block |
Current system time, 10321 | 1 to 16, 20 |
|
Touch-probe data, 10350 | 50 | Probe type of the active touch probe TS |
70 | Probe type of the active touch probe TT | |
73 | Key name of the active touch probe TT from MP activeTT | |
Data for pallet machining, 10510 | 1 | Name of the pallet being machined |
2 | Path of the selected pallet table | |
NC software version, 10630 | 10 | Version identifier of the NC software version |
Information for unbalance cycle, 10855 | 1 | Path of the unbalance calibration table belonging to the active kinematics |
Tool data, 10950 | 1 | Tool name |
2 | DOC entry of the tool | |
3 | AFC control setting | |
4 | Tool-carrier kinematics |
Read machine parameters with CFGREAD
With the CFGREAD function, you can read out machine parameters of the control as numerical values or as strings. The read-out values are always output in metric units of measure.
- To read a machine parameter, you must determine the following contents in the configuration editor:
- Parameter name
- Parameter object
- If present, group name and index
Accepting the contents of a machine parameter
Symbol | Type | Meaning | Example |
---|---|---|---|
Key | Group name of the machine parameter (if available) | CH_NC | |
Entity | Parameter object (name begins with Cfg...) | CfgGeoCycle | |
Attribute | Name of the machine parameter | displaySpindleErr | |
Index | List index of a machine parameter (if available) | [0] |
If you are in the configuration editor for the user parameters, you can change the display of the existing parameters. In the default setting, the parameters are displayed with short, explanatory texts.
Each time you want to interrogate a machine parameter with the CFGREAD function, you must first define a QS parameter with attribute, entity and key.
- The following parameters are read in the CFGREAD function’s dialog:
- KEY_QS: Group name (key) of the machine parameter
- TAG_QS: Object name (entity) of the machine parameter
- ATR_QS: Name (attribute) of the machine parameter
- IDX: Index of the machine parameter
Assigning text to a QS parameter
Before you can use and further process texts, you must assign the characters to QS parameters. Use the DECLARE STRING command to do so.
| ||
![]() |
| |
| ||
|
In this example, a text is assigned to the QS parameter QS10.
37 DECLARE STRING QS10 = "workpiece" |
Linking QS parameters
You can use the concatenation operator || to link the characters of multiple QS parameters. This allows you to combine fixed and variable text elements.
| ||
![]() |
| |
| ||
| ||
| ||
|
In this example, QS10 should contain the complete text of QS12, QS13, and QS14.
37 QS10 = QS12 || QS13 || QS14 |
Parameter contents:
- QS12: Workpiece
- QS13: Status:
- QS14: Scrap
- QS10: Workpiece Status: Scrap
Converting variable text content to numeric values
The TONUMB function allows you to store numeric characters of a QS parameter as the value of a variable. The value to be converted can only consist of numbers. The stored value can be used, for example, to perform calculations.
In this example, the QS parameter QS11 is converted to the numerical parameter Q82.
37 Q82 = TONUMB ( SRC_QS11 ) |
Converting variable numeric values to text content
You can use the TOCHAR function to save the contents of a variable to a QS parameter. You can link the saved content with other QS parameters, for example.
In this example, the content of the numeric parameter Q50 is transferred to the string parameter QS11.
37 QS11 = TOCHAR ( DAT+Q50 DECIMALS3 ) |
Copying a substring from a QS parameter
The SUBSTR function allows you to save a definable range from one QS parameter to another QS parameter. For example, you can use this function to extract the file name from an absolute file path.
In this example, the syntax element BEG2 is used to read a four-character substring from the third character, since counting starts from zero and LEN4 is commanded.
37 QS13 = SUBSTR ( SRC_QS10 BEG2 LEN4 ) |
Searching for a substring within the content of a QS parameter
You can use the INSTR function to check whether a specific substring is within a QS parameter. This allows you to check, for example, whether the concatenation of multiple QS parameters has worked. Two QS parameters are required for the check. The control searches the first QS parameter for the content of the second QS parameter.
If the control cannot find the substring to be searched for, the control saves the total number of characters to the result parameter.
If the substring to be searched for appears multiple times, then the control returns the first place at which it finds the substring.
In this example, QS10 is searched for in the text stored in QS13. The search starts from the third character. When counting the characters, start with zero.
37 Q50 = INSTR ( SRC_QS10 SEA_QS13 BEG2 ) |
Determining the total number of characters in a QS parameter
The STRLEN function returns the length of the text stored in a selectable QS parameter. You can use this function to determine the length of a file path, for example.
In this example, the length of QS15 is determined.
37 Q52 = STRLEN ( SRC_QS15 ) |
Comparing the alphabetical order of two QS parameter contents
The STRCOMP function allows you to compare the alphabetical order of the contents of two QS parameters. For example, you can use this function to check whether a QS parameter contains uppercase or lowercase letters. The control first searches all uppercase letters alphabetically and then all lowercase letters alphabetically.
The control returns the following results:
- 0: The compared QS parameters are identical
- –1: The first QS parameter precedes the second QS parameter alphabetically
- +1: The first QS parameter follows the second QS parameter alphabetically
This example compares the alphabetical order of QS12 and QS14.
37 Q52 = STRCOMP ( SRC_QS12 SEA_QS14 ) |
Accepting the contents of a machine parameter
You can use the NC function CFGREAD to transfer the content of a machine parameter to a QS parameter.
Depending on the content of the machine parameter, you can use the CFGREAD function to copy text content to QS parameters or numeric values to Q, QL or QR parameters.
In this example, the axis designation of the fourth axis is loaded as a QS parameter.
- Specified settings in the machine parameters:
- DisplaySettings
- CfgDisplayData
- axisDisplayOrder
- [0] to [5]
14 QS11 = "" | ; Assign QS parameter for the key |
15 QS12 = "CfgDisplaydata" | ; Assign QS parameter for the entity |
16 QS13 = "axisDisplay" | ; Assign QS parameter for the parameter name |
17 QS1 = CFGREAD( KEY_QS11 TAG_QS12 ATR_QS13 IDX3 ) | ; Read out machine parameter(s) |
Note
When you use the STRING FORMULA function, the result of the performed arithmetic operation is always a string. When you use the FORMULA function, the result of the performed arithmetic operation is always a numeric value.
Definition
String
In computer science, a string is a defined sequence of alphanumeric characters, i.e. texts. The control uses QS parameters to process strings.