Gcode won't open in ground control on mac

Had everything working fine but now when I try to open newer text files of Gcode I get this error.

ground%20control%20error

I’m 'making the Gcode in 'numbers/excell and copying it into text edit where I double check it and rename it with a .nc Then head over to Ground control and open it. This was all working till a day ago. Is there some detail to the text file type that I’m missing? Any better text editors on Mac that don’t cost $100

I suspect it has something to do with the infuriating text edit on Mac but I just can’t figure out what is different between a file that opens fine and one that gets this error.

Any ideas?

Can you compress the file and upload it here?

You might check that there isn’t a suffix which isn’t showing. In the Finder, highlight the file and cmd-I to ‘Get Info’ about the file and look to see that the file name ends with .nc (or .txt).

1 Like

You might also have a problem with Line End format that is invisible to see unless you use a hex editor. Can I ask why your hand coding G-code?

Thank you

TextEdit.app saves files by default as RichText not .txt, this can be changed in the ‘save’ dialogue options.

Check out Atom.app (https://atom.io) or the old favorites on the command line, vi and emacs are both there…

There are many options, but TextEdit.app isn’t the best.

3 Likes

Hi all - I poked around in finder and nothing strange there. All files are plain text and .nc This was working a few days ago so I’ve taken a working code file and a non working one from today. “sunday test2” is the non working one - links here:

I’m working on a tiny manufacturing project cutting out rectangles with round corners so I had made some progress using a spread sheet to make all the repetitive code. Also was able to eliminate unnecessary machine movements this way. In the past I just selected a whole column in the spread sheet and copy/pasted that into text edit. Just kept doing that for all the different rectangles. So I might have changed something in the spread sheet with some hidden formatting? But of course I can’t see anything that’s different.

Anyway it does seem to be a line ending or hidden text file thing.

Thanks for the help!

1 Like

camotivs gives me plenty of:
ERROR:/home/whoareyou4/Downloads/test/working and non working gcode/sunday test 2.nc:11:4:Invalid character: ‘\x2212’

1 Like

The file that doesn’t work contains the unicode character for “-” everywhere there is a “Z-” Replacing those with an UTF-8 “-” will make the file load correctly. Here’s a ‘fixed’ version: sunday-test-2-fix.nc (5.5 KB)

4 Likes

grep --color=‘auto’ -P -n “[^\x00-\x7F]” st2.nc

11:G1 Z−0.125 F40
13:G1 Z−0.25 F40
15:G1 Z−0.375 F40
17:G1 Z−0.5 F40
111:G1 Z−0.125 F40
113:G1 Z−0.25 F40
115:G1 Z−0.375 F40
117:G1 Z−0.5 F40
210:G1 Z−0.125 F40
212:G1 Z−0.25 F40
214:G1 Z−0.375 F40
216:G1 Z−0.5 F40

This are the line numbers with the ‘other’ minus

Edit: Add the source link grep-for-all-non-ascii-characters

2 Likes

Awesome! that was it. I had a concatenated text string when I could have just had a negative number for the z value. Got rid of the “Z-” string and used “Z” and the neg number - works great now.

Also I’ll check out more on the invalid characters, Atom and Camotics

thanks all!

4 Likes