Calculators
NC file check and fix
Check line endings (CR LF), invisible characters, non-ASCII text in comments and the % marks before sending a program to the machine, then download the fixed file. Everything runs in your browser; the program never leaves your computer.
Pasted text cannot be checked for line endings, BOM or encoding, because the browser has already changed them. Open the file to check everything.
File—
Encoding—
Line endings—
Fix the file
Why a correct program will not go into the machine
A program file is a text file. Besides the characters you see, it has invisible characters that each system uses differently. A text editor on a computer shows every kind the same, but a controller is not as forgiving.
- Line endings: Windows ends a line with two characters, CR LF; Unix and Linux use LF alone; old Macs used CR alone. In the ISO code that Fanuc-type controllers use, EOB (end of block) is the LF character. Most controllers skip the CR, but some models and transfer settings do not.
- Mixed line endings usually come from joining programs from several sources, or editing a file with several programs.
- BOM (byte order mark): three invisible bytes that some programs, such as older Notepad, put at the very start of a file to mark it as UTF-8. Editors hide them so the file looks normal, but the controller reads stray characters before the % and raises an alarm or refuses the file. The fixer always removes it.
- Non-ASCII text in comments: most controllers take ASCII only, so Thai, accented or other non-ASCII letters in brackets can stop the file going in. Files saved by older Windows programs may be in a local code page such as TIS-620.
- The % marks: over a cable, and with some memory card methods, the controller starts reading after the first % and stops at the second.
What the fixer changes
- Only the line endings, spaces, letter case, comments and % lines, as chosen. It does not change any address letter or number in the code.
- Lower-case letters in comments are left alone unless chosen. Most newer controllers take them; if an older machine raises an alarm on lines with lower-case comments, choose to change them too.
- The BOM and invisible control characters (such as Ctrl-Z) are always removed, and a line ending is added after the last line.
- The result is plain ASCII when no non-ASCII text is left. If comments are kept, the file is UTF-8 without a BOM.
- A line left with nothing but a removed comment is removed entirely.
- Press Fixed file above the file view to see the result before downloading.
Limits
- It does not know what your machine takes. When sending over a cable (RS-232) or with DNC software, the sending program's settings, such as the line ending, must match the machine's parameters. See the machine's manual or ask whoever looks after it.
- It does not check the program itself. Use the backplot to see the toolpath.
- Text after the closing % is not removed, because it may be a subprogram that you need to move above the % yourself.
- Stray characters in the code must be fixed by hand, such as Thai digits (X๑๐) or full-width letters typed with a Chinese or Japanese keyboard (G01). The fixer never changes letters or numbers in the code, so no value in the program changes without someone checking it; fix the lines it lists. The exception is special spaces copied from a web page or Word, which become ordinary spaces.
- Comments after ;: the checker knows only Fanuc-style comments in brackets, such as
(DRILL 8.5). Comments after ;, used by some controllers such as Siemens, are checked as code, so non-ASCII text in them is listed as something to fix by hand; the option to remove comments does not affect them, and their letters are made capital if that is chosen.