G-Code Development

From Open Source Ecology
Jump to: navigation, search


G-Code research conducted in research of the CNC Torch Table CNC Torch Table


Or how I actually tell the Torch Table to move.

G-code is a loose standard. That means if you take some other G Code that you did not write, there is a good chance it will not work. The reason is that each G Code interpreter, be it EMC2, RepRap motherboard, or fancy six axis robotic arm controller were all produced for a specific job which require a specific tool path, on a specific machine. Now if you're a computer scientest or programmer, you're going "wait a minute, why don't they just make the language more intelligent, add in a required machine descriptor and abstract the tool path away from the user which forces users to hand craft each part they want to make!" Which is a valid point, and I would encourage someone to come up with a better language, because G Code sucks.

G-code, ala EMC2

Or how prototype 1 is put together.

Because we don't have an "arc stable, good to cut" we will use a delay instead which means that we'll have to find someplace on the material we can "burn into" while the arc stabilizes. This will have to be hand coded to some extent I am afraid.

There is a lot of good information in the manual which will be nessisary to hand craft G-code - G-code overview

The other option is to use a program to generate g code from a drawing or cad software. The problem with this is that it usually does a point by point move, where a human operator could use a loop and arc move instead to achieve the same results. Furthermore, because there is no guarantee that they conform to the same g code standards as your controller, it is likely that any g code that is automatically generated will need to be tweaked first. If it isn't apparent yet, g code is time intensive to produce. Its saving grace is that once you have it, you can run the same program over and over again.

Lets take a look at the below file that was generated using Inkscape and this G-code plugin

(Found 1 paths for AllObjects:)
G20 (All units in inches)
#1=0.5000 (Height to traverse when not cutting)
#2=0.0000 (Height to cut at)
#3=10.0000 (Tool feed rate)
#4=1.0000 (X axis scale factor)
#5=1.0000 (Y axis scale factor)
(Path has size 36.000 x 54.000)
(Path has bounding box 4.500-40.500 wide by 4.000-58.000 high)
G00 Z#1 
G00 X[4.5000*#4] Y[58.0000*#5] 
G00 F#3 Z#2 
G01 X[4.5000*#4] Y[58.0000*#5] 
G01 X[36.0000*#4] Y[58.0000*#5] 
G01 X[4.5000*#4] Y[35.5000*#5] 
G01 X[40.5000*#4] Y[31.0000*#5] 
G01 X[13.5000*#4] Y[13.0000*#5] 
G00 Z#1 
G00 X[0.0*#4] Y[0.0*#5] 

This program has options for some basic conveniences, but its true power is that it allows for a simple conversion path from a drawn path to actual g code. That being said, I wouldn't use it for anything more complex than making holes and contours. Luckily thats what most people want it for.

For example, the # with a number following allows for macro variable replacement, so minor changes, like going from millimeter to inches, isn't such a pain.

More info can be had at by looking to the emc2 manual for information on G code.

Other sources for g code generated goodness. TBC

See Also