Translator

Translator is a text file translator, developed for translating CNC programs from one machine controller to another.

Features

Version

Download

Usage

The main window has the file to be translated on the left and the translated file on the right.

Screen Shot

Options for pasting from the clipboard and opening a file are available from the buttons or menus.

Click on the Translate button to carry out the translation.

Either Save the file or Copy it back to the Clipboard.


The Translator Editor is where the translations are configured using the built in macro language.

Screen Shot

Details of the Translator Macro Language

Each command must be on its own line and must have all the parameters included, blank lines are ignored. Parameters are separated by | characters.

By default the translator definition files have a .tcf extension.

You can choose where to store your translator files then point the translator to them in the tools menu options item.

The Translation file is read and refreshed when the Translation is carried out, so changes to the translation file are active as soon as the translation configuration file is saved.

Command Parameters Explanation
#

Comment

Used to add notes to the translator file, placed at the start of the line, all text after the # is ignored.

WarnIfFileIncludes |String|Message

This command will pop up a warning dialogue box if the 'String' is in the file being translated. The Message text will be the message displayed.

This command does not honour exclusions, if there is an exclude command before this one which excludes the line with String in it then the message box will still be shown.

WarnIfFileNotIncludes |String|Message

This command will pop up a warning dialogue box if the 'String' is in the file being translated. The Message text will be the message displayed.

The same conditions apply for exclusions.

WarnIfLineIncludesAndNot |N|FindThis|WhenNotThis|Message

This will pop up a message box with the 'Message' text in it if a line with the 'FindThis' text but not the 'WhenNotThis' text is found. It will be shown once for each line where the conditions are met.

This command can be made case sensitive by using 'Y' as the first parameter, use 'N' to make this command ignore case.

Exclusions are honoured with this command.

ExcludeFirstLines |3

Excludes the number of lines stated in the parameter from further commands in the translation.

More than one of these commands can be in a Translation. If there are some things to be carried out on all of the file, then just a part of it you can use this command more than once to control the parts of the file affected.

ExcludeLastLines |3 Works in exactly the same way as ExcludeFirstLines but from the end of the text.
IncludeFirstLines |3 The commands following this one will only be applied to this number of lines at the start of the text.
IncludeLastLines |3 The commands following this one will only be applied to this number of lines at the end of the text.
ResetIncludeExclude Resets the Exclude or Include lines so command following this one will be applied to the whole text.
ExcludeLinesWith |String Exclude lines with 'String' in them from following translation commands.
ExcludeTextBetween |{|}

Exclude text between the first parameter and the second parameter from following translation commands.

Can be used to exclude text in brackets.

ReplaceText |N|changethistext|tothistext Straight forward text replacement command, if the first parameter is 'Y' then it is case sensitive, if 'N' then it is not.




ModifyNumber





|-0.0|Y|X|*1.05

With this command numbers can be modified with * / + and - operators.

The first parameter is the output format

The second parameter defines if the resulting number can have a '.' at the end or if it is removed.

The third parameter is the letter the number to be changed follows.

The last parameter is the operator and value to be applied.

Some examples of ModifyNumber

Original Text Parameters Translated Text Comment
N100 X10.64 Y-9.6 Z4 |-0.0|Y|X|*1.05 N100 X11.2 Y-9.6 Z4 The x value is scaled up by 5%.
N100 X10.64 Y-9.6 Z4 |-0.00|Y|Y|*-1 N100 X10.64 Y9.60 Z4 The Y value sign is swapped, effectively a mirror of the Y axis.
N100 X10.64 Y-9.6 Z4 |-0.00|Y|Z|+5 N100 X10.64 Y-9.6 Z9.00 The Z value is increased by 5 and now has 2 trailing zeros.
N100 X10.64 Y-9.6 Z4 |-0|Y|X|+5 N100 X16 Y-9.6 Z4 The X value is increased by 5 and rounded to no decimal places.
N100 X10.64 Y-9.6 Z4 |-0.0|Y|Z|+5 N100 X10.64 Y-9.6 Z9.0 The Z value is increased by 5 and now has 1 trailing zero.
N100 X10.64 Y-9.6 Z4 |-0.|Y|Z|+5 N100 X10.64 Y-9.6 Z9. The Z value is increased by 5 and now has a trailing point.
N100 X10.64 Y-9.6 Z4 |-0.|N|Z|+5 N100 X10.64 Y-9.6 Z9 The Z value is increased by 5 and now has no trailing point.
N100 X10.64 Y-9.6 Z4 |-.00|Y|X|-10.5 N100 X.14 Y-9.6 Z4 The X value is decreased by 10.5 and now has no leading zero.
DeleteLinesContaining |N|String

Deletes any lines containing the 'String', use 'Y' for the first parameter to make it case sensitive and 'N' for not case sensitive.

This command obeys the exclusions set in the translation.

AddToLineIncluding |N|FindThisText|AddThisText

Add text to the end of a line containing the stated text. The first parameter is the Case Sensitivity, the second is the text to find and the third is the text to add to the end of the line.

This command obeys the exclusions set in the translation.

InsertLineAfter |N|FindThisText|AddThisText

This command inserts a line after every line containing the second parameter text and puts the third parameter text in the inserted line. If the first parameter is 'N' then the command is not case sensitive, if it is 'Y' then it is case sensitive.

This command obeys the exclusions set in the translation.

InsertLineBefore |N|FindThisText|AddThisText

This command inserts a line before every line containing the second parameter text and puts the third parameter text in the inserted line. If the first parameter is 'N' then the command is not case sensitive, if it is 'Y' then it is case sensitive.

This command obeys the exclusions set in the translation.

AddSpacesBetween |N|0123456789.|XYZR

Adds a space between every occurence of one of the second parameter characters and one of the third parameter characters.

The shown values would add a space between every number and XYZ or R.

N100X10.64Y132.79Z-6.5 would become N100 X10.64 Y132.79 Z-6.5

If the first parameter is 'N' then the command is not case sensitive, if it is 'Y' then it is case sensitive.

This command obeys the exclusions set in the translation.

DeleteBlankLines Deletes any blank lines in the text, does not take any notice of any exclude or include lines, the whole text will be processed.
ChangeCase |U Change the case of all the unexcluded text, set the parameter to 'U' for upper case, 'L' for lower case and 'T' for title case.

Version History

Home Site Map Licence and Warranty