G-Code & DXF File Explanation

While some CNC machines come with software that can be used both to create shapes and run the machine, their drawing capabilities are generally quite limited compared to dedicated drawing programs.

DXF file explanation:  Drawing Exchange Format files, or DXF files as they are generally referred to, are files that incorporate a format that is understood by most drawing programs, as well as CNC (Computer Numerical Control) software.  It can be viewed as an interpreter between the program with which you create your designs, and the software used by the machine that executes them.  Since this takes place in the background, it is unnecessary to understand the various algorithms and nuances involved.

G-code explanation:   It is sometimes necessary to look at the G-Code for a shape you are endeavoring to cut to identify glitches and occasionally to do some fine tuning.  Most high- quality CNC software makes it virtually unnecessary to delve into G-code, but it doesn’t hurt to have a basic understanding of what it does.

There are a variety of dialects of G-Code, depending on the type of machine being run, the nature of the machining or cutting process, and the machine’s manufacturer.  However, there is some commonality between them.

G-Code, at its most basic level, is a set of instructions to the machine to send the cutting tool to a series of X/Y coordinates.  The code also tells the machine to perform certain functions along the route.  These include ramping instructions (acceleration & deceleration), torch or other cutting tool on/off, dwell time (interval between torch/tool on and commencement of movement).

In most cases, instructions en route will include rapid movement traverse (movement between cuts with the tool off) and a cutting speed for movement between coordinates with the torch/tool on.

Since there some variances between different machines, it is necessary to consult your machine’s operator manual for the G-Code commands specific to your machine.  The G=Code for a simple octagon is shown at right.  Note that the coordinates are to six decimal points, signifying a high degree of precision.DXF 

Below is a G-Code file for a simple octagon, with an explanation for each line of code.  The reason there are this many lines for an eight-sided shape is that each point has three coordinates to soften the direction changes.

Use inch incrementsG20
Use settings for Powermax 85 (dwell, speeds, etc.)M106 Hplasma1 
Cutting Mode#fabhead.mode = Cut
Rapid traverse to start of first cutG00 X0.382582 Y1.491569
With torch on – go to set of X/Y coordinatesG01 X-0.009239 Y2.505571
With torch on – go to set of X/Y coordinatesG01 X-0.010000 Y2.509398
With torch on – go to set of X/Y coordinatesG01 X-0.009239 Y2.513224
With torch on – go to set of X/Y coordinatesG01 X0.725745 Y4.287638
With torch on – go to set of X/Y coordinatesG01 X0.727913 Y4.290882
With torch on – go to set of X/Y coordinatesG01 X0.731157 Y4.293050
With torch on – go to set of X/Y coordinatesG01 X2.505571 Y5.028034
With torch on – go to set of X/Y coordinatesG01 X2.509398 Y5.028795
With torch on – go to set of X/Y coordinatesG01 X2.513224 Y5.028034
With torch on – go to set of X/Y coordinatesG01 X4.287638 Y4.293050
With torch on – go to set of X/Y coordinatesG01 X4.290882 Y4.290882
With torch on – go to set of X/Y coordinatesG01 X4.293050 Y4.287638
With torch on – go to set of X/Y coordinatesG01 X5.028034 Y2.513224
With torch on – go to set of X/Y coordinatesG01 X5.028795 Y2.509398
With torch on – go to set of X/Y coordinatesG01 X5.028034 Y2.505571
With torch on – go to set of X/Y coordinatesG01 X4.293050 Y0.731157
With torch on – go to set of X/Y coordinatesG01 X4.290882 Y0.727913
With torch on – go to set of X/Y coordinatesG01 X4.287638 Y0.725745
With torch on – go to set of X/Y coordinatesG01 X2.513224 Y-0.009239
With torch on – go to set of X/Y coordinatesG01 X2.509398 Y-0.010000
With torch on – go to set of X/Y coordinatesG01 X2.505571 Y-0.009239
With torch on – go to set of X/Y coordinatesG01 X0.731157 Y0.725745
With torch on – go to set of X/Y coordinatesG01 X0.727913 Y0.727913
With torch on – go to set of X/Y coordinatesG01 X0.725745 Y0.731157
With torch on – go to set of X/Y coordinatesG01 X0.358253 Y1.618364
With torch off – go back to home positionG00 X0.000000 Y0.000000

G-Code & DXF File Explanation