[Solved] "Bad character '-'" (and '+') in G-code. Program won't load.

More
18 Dec 2016 19:49 - 18 Dec 2016 19:51 #84370 by clunc
I'm posting this because, after 8 years of staring at G-code (as a hobbyist only), I am (a) 8 years older, and (b) capable of the most foolish of mistakes.

I'm accustomed to hand-editing programs spit out of my CAM software, to change constants over to variables, etc. This involves "doing a little typing," and I've done it so many times, it's old hat, and I don't even see it. (...and I don't even see it.)

So "all of a sudden!", even though "I never changed anything!" and "it had always worked before!", LinuxCNC threw a "Bad character '-'" error on one of the last lines a recent program I loaded. Just the one line. All the other '-'s in the code were fine; only in that one place did it hate the '-'. (I had been away from the machine for a couple of weeks.)

It happened to be one of those hand-edits I always add to park the cutter at the end of the code. I use absolute coords:
G53G90G0-Z0.5

Do you see it? Good for you! You are a professional! I stared and stared at it. It was only as I was typing up a problem report (something like Why is My Version of LinuxCNC Possessed?) that I finally saw it. (I had the whole screen cap and everything... sheesh).

G-code AIN'T algerber: there's No Such Thing as -Z (or -X or -Y) in G-code syntax.

Z-0.5.

Posted on the off-chance that someone else might search for "Bad character" here someday. I wish I had those four hours back... ;^)
Last edit: 18 Dec 2016 19:51 by clunc.

Please Log in or Create an account to join the conversation.

More
19 Dec 2016 00:11 #84383 by andypugh

G-code AIN'T algerber:


Though it is quite close to Gerber ;-)

Please Log in or Create an account to join the conversation.

More
19 Dec 2016 02:40 #84393 by Todd Zuercher
I could see how that could be a frustratingly difficult typo to pick out at first.

Please Log in or Create an account to join the conversation.

More
19 Dec 2016 14:35 #84412 by clunc
In fact, at one point I even typed three lines of code to test, quite oblivious to where I was placing signs:
G53G90G0Z0.5
G53G90G0Z-0.5 # right
G53G90G0+Z0.5 # WRONG
only to conclude that thing which didn't like negatives had changed its mind and now didn't like +!

(Oh, must dash; the nice man is here with my sanity pills.)

Please Log in or Create an account to join the conversation.

More
19 Dec 2016 15:05 #84413 by clunc
@andypugh

lol

I had an "ah-ha!" revelation that, that must be the explanation for the 'G'! "Must be Gerber!"

Wikipedia doesn't actually out-and-out credit Gerber with it however, although it suggests that a Gerber file is a flavor (RS-274-D) of regular G-code (RS-274) and the wikipedia entry for "Gerber file" refers to RS-274-D as "Standard Gerber" format, but which is "obsolete" and "revoked."

In a separate article (en.wikipedia.org/wiki/History_of_numerical_control), G-code is identified as having first been used on GerberScientific plotters and was later adapted for CNC use.

However, a search for 'G-code' at www.gerberscientific.com (redirects to www.gerbertechnology.com) returns:
"No results found for search term g-code."

(Now looking into the history of the troublesome minus sign... Is it, really, necessary...)

Please Log in or Create an account to join the conversation.

More
19 Dec 2016 15:28 #84414 by Todd Zuercher
And to venture further off topic, I work with some older Gerber Scientific CNC routers, and what they run natively isn't even close to G-code (it isn't even human readable code), although they can be configured to accept a rudimentary form of G-code.
(If we didn't have a huge library of work (many years of man hours) created using the old Gerber Software, these machines would probably be waiting in line for a Linuxcnc brain transplant.)

Please Log in or Create an account to join the conversation.

More
28 Jan 2017 05:55 #86824 by jmelson

G-code AIN'T algerber:


Though it is quite close to Gerber ;-)


There's a reason for that. G-code is officially RS-274D. Gerber files are a form of RS-274 with suppressed decimal points.
The original Gerber photoplotter used a GE CNC control, and the tool changer selected an aperture on a wheel.
Then, it did modal moves, and the modal command in effect selected between dark move, light on when moving or flash at that location. So, all very standard G-code stuff.

Jon

Please Log in or Create an account to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum