Guide · Programming

From DXF Drawing to G-Code: A Clean 2D Workflow

How to prepare a DXF drawing for CNC milling, plasma or laser: units, closed contours, duplicates, cutting order, compensation and tabs, with a free converter that runs in the browser.

By cnccode · Updated
On this page
  1. Clean the drawing
  2. Choose the cutting order
  3. Compensation
  4. Keep the part from flying away
  5. Before you start
  6. More guides
  7. Frequently asked questions

A DXF is the most common way to hand over a flat part. It is also the source of many small problems: wrong units, gaps between lines and hidden duplicates. Ten minutes of cleaning saves an hour at the machine.

Clean the drawing

  1. Scale: measure one known dimension. DXF files do not reliably store units.
  2. Delete everything that is not cut: dimensions, title block, centre lines.
  3. Join the lines: every outline must be a closed chain. Gaps larger than a few hundredths of a millimetre break it.
  4. Remove duplicates: two lines on top of each other are cut twice. Most CAD programs have an OVERKILL or similar command.
  5. Convert splines to polylines with arcs. Thousands of tiny lines make a machine stutter.

Choose the cutting order

Cut inside shapes first and the outer contour last. Once the outside is cut, the part can move. The DXF to G-code converter does this automatically.

Compensation

The tool has a width, so a hole cut on the line becomes too large and the outside too small. There are three ways to handle this:

  • Draw an offset contour in CAD. Works on every machine.
  • Use G41 with the radius in the offset table. Best on industrial controls because you can correct the size at the machine.
  • Cut on the line. Correct for engraving and scoring.

Keep the part from flying away

When the last pass goes through the sheet, the part is free. Use double-sided tape, vacuum, screws in the waste area, or leave a thin skin of 0.1 to 0.2 mm and cut it by hand. Tabs of 3 to 5 mm width are the usual choice on routers.

Before you start

Open the program in the G-code viewer and check three things: the size in X and Y, the position of zero, and the lowest Z.

Frequently asked questions

Which DXF version should I save?
ASCII DXF in version R12 or 2000 is read by nearly every program.
Why does my converted part contain thousands of short lines?
The drawing contained splines or was exported from a 3D program as segments. Convert them to arcs with a tolerance of about 0.01 mm before exporting.
Was this page helpful?