Predefined subprogram <Filter>
All postprocessors include the predefined subprogram <Filter>, which can be found in the subprograms list. <Filter> is called immediately after the NC-program block was formed and before it is added to the NC-program text. Thus, this subprogram allows the user to edit every NC-program block at the moment of its output. For example, it is possible to replace symbols or add marks at the end or at the beginning of a line.
By default the system creates the following subprogram prototype for the <Filter>:
sub Filter(S: string)
subend
The formed NC-block is passed through the <S> parameter. All changes to that string will be put into the NC-program text.
Example:
sub Filter(S: String)
replace(S,"R1","L") ! Replace "R1" with "L"
replace(S,"R-1","R") ! Replace "R-1" with "R"
replace(S,"F0","FMAX") ! Replace "F0" with "FMAX"
subend
Executing this code for the block "17 L Z-10 R0 F0" will result with the line of NC-program "17 L Z-10 R0 FMAX".
See also:
Predefined variables and functions
The replace statement of the substring in a string <REPLACE>