How to Convert 2D File for CNC Machine
This guide is for engineers and designers who need to convert 2D file for CNC machine work without scrapping parts. It covers geometry cleanup, unit checks, contour closure, and the export settings we verify every day in our own shop.

In this article
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Key takeaways
Why a clean 2D drawing still fails in CAM
Most 2D conversion problems are not software bugs. They come from the drawing itself. A line that looks continuous on screen may be three separate segments with hairline gaps at the joints. CAM software reads geometry, not appearance, so those gaps stop pocketing and profiling operations.
The second common cause is layer and color confusion. Designers often place outline, centerline, dimension, and hatching on one layer. CAM then treats dimension lines as cut paths. Keep one layer for cutting contours, one for reference, and delete or freeze everything else before export.
The third cause is unit mismatch. DXF stores coordinates as numbers and a header that says what those numbers mean. If the header says inches but the designer drew in millimeters, the part arrives 25.4 times too large. The machine will still cut it, and the material is gone.
- 1Geometry, not pixelsRaster images cannot generate a toolpath.
- 2One layer per purposeCut contours, reference, and text belong apart.
- 3Units live in the headerWrong header means wrong part size.
Which 2D formats CAM software actually accepts
DXF is the standard exchange format for 2D machining, laser cutting, and waterjet work. It carries lines, arcs, polylines, and splines as vector data, and every mainstream CAM package reads it. DWG works too, but version differences between AutoCAD releases cause more import errors than DXF.
PDF is a print format. Some CAM tools can trace a PDF, but the result is an approximation, not your original geometry. If a PDF is all you have, rebuild the outline rather than trusting an auto-trace. SVG often contains nested groups, clipping masks, and unsupported elements; strip those before import or the contour will break.
Raster files such as JPEG, PNG, and scanned TIFF contain no machinable vector data. They are fine as a visual reference next to the DXF, not as the source. If your part only exists on paper, dimension it and redraw it as vectors.
- 1DXFBest all-round choice for milling and turning profiles.
- 2DWGAcceptable, but watch the saved version.
- 3SVG and PDFClean or rebuild before use.
- 4JPEG, PNGReference only, never a toolpath source.
Cleaning geometry before you convert 2D file for CNC machine
Start with an overkill pass. Run a cleanup command to remove zero-length lines, duplicate entities, and stray points. Then use a join or polyline edit tool to merge connected segments into single polylines. A profile that should be one closed loop but is actually 40 short lines is a common source of CAM warnings.
Close every contour that will be cut or pocketed. Join the endpoints, then verify with an area or list command. A truly closed polyline reports a valid area; an open one does not. Gaps smaller than 0.001 mm still break offset calculations, so do not rely on visual inspection at zoom level.
Explode text, dimensions, and hatching into plain geometry, or delete them. TrueType fonts often convert into fragmented outlines with self-intersections. For engraved markings we keep character height at 1.5 mm or larger, because smaller strokes wear tools and blur the cut.
Check for self-intersecting and overlapping entities. Two lines running on top of each other double the toolpath and can trip a gouge check. Where a slot meets an outer edge, trim the overlap so the geometry has one clean boundary.
- 1Overkill firstDelete zero-length lines, duplicates, and points.
- 2Join and verifyClosed polylines report a valid area.
- 3Explode textFragmented font outlines cut badly.
- 4Trim overlapsDoubled geometry doubles the toolpath.
Units, scale, and the one dimension you must verify
Set drawing units in the CAD file before export, not in CAM after import. If the part is metric, set millimeters; if imperial, set inches. Mixed-unit drawings are the hardest to repair because some entities were drawn at one scale and some at another.
Insert one known reference dimension, such as a 100 mm line or a 4.000 in line, and keep it on a separate layer. After import, measure that line in CAM. If it reads 100 mm, the scale is correct. If it reads 3.937 in or 2540 mm, stop and fix the units before doing anything else.
Watch the decimal precision on export. Twelve decimal places create noise in the file; two or three are enough for most machined profiles. For a ±0.005 mm tolerance we still import the original full-precision DXF and let CAM handle the rounding.
Do not scale geometry to make it fit a stock size. Scale changes every dimension, including hole diameters and thread callouts. Adjust the stock or the setup instead.
- 1Set units in CADNot in CAM after the fact.
- 2One reference line100 mm or 4.000 in, measured after import.
- 3Reasonable precisionThree decimals is plenty for profiles.
- 4Never scale to fitIt changes hole sizes too.
Export settings that keep the file readable
Export as DXF R12 or R14 unless your CAM software asks for a newer release. Older versions carry fewer object types and import more reliably across packages. Save splines as polylines when the CAM tool cannot offset splines, and set a chord tolerance of 0.01 mm or finer.
Write the DXF in model space at 1:1. Paper space layouts, viewport scales, and title blocks confuse many importers. If the drawing must keep its title block, move the cutting geometry into model space and reference the border separately.
Keep the file to one part per DXF when the parts will be nested later. Multi-part sheets are fine for laser and waterjet, but for milling we prefer a single contour set per file so setup and work offset stay clear.
Finally, name layers by function: CUT, ENGRAVE, REF. CAM operators map toolpaths by layer, and clear names cut programming time and mistakes.
- 1DXF R12 or R14Broadest import compatibility.
- 2Model space, 1:1No viewport scaling.
- 3One part per fileCleaner work offsets for milling.
- 4Name the layersCUT, ENGRAVE, REF.
Step by step: convert 2D file for CNC machine
Follow this order. Skipping ahead to CAM import is where most rework starts.
- 11. Find the true sourceLocate the native CAD file, not a PDF or screenshot. If only a print exists, redraw it with dimensions before anything else.
- 22. Set units and scaleSet the drawing to millimeters or inches and confirm it is 1:1 in model space. Add a 100 mm or 4.000 in reference line on its own layer.
- 33. Clean the geometryRun overkill to remove zero-length lines, duplicates, and points. Delete construction lines, dimensions, and hatching you do not need.
- 44. Join and close contoursJoin connected segments into polylines and close every cut or pocket boundary. Confirm closure with an area or list check, not by eye.
- 55. Explode text and outlinesConvert text you want engraved into vector paths. Keep character height at 1.5 mm or above. Delete text you do not want cut.
- 66. Trim overlaps and self-intersectionsWhere a slot meets an edge or two lines overlap, trim to one clean boundary so the toolpath offset has no ambiguity.
- 77. Export DXF at 1:1Save as DXF R12 or R14 from model space. Use a chord tolerance of 0.01 mm or finer for any spline converted to polyline.
- 88. Verify after importMeasure the reference line in CAM, check that contours are closed, and confirm the offset direction before posting the toolpath.
2D file formats for CNC conversion
Use this when deciding what to send your machine shop.
| Format | Vector data | Typical use | Risk to watch |
|---|---|---|---|
| DXF | Yes | Milling, turning, laser, waterjet | Wrong unit header in old files |
| DWG | Yes | Native CAD exchange | Version mismatch on import |
| SVG | Partly | Web and laser graphics | Clipping masks, nested groups |
| Traced only | Reference and drawing review | Auto-trace changes dimensions | |
| JPEG / PNG | No | Visual reference only | No toolpath possible |
| STEP / IGES | 3D | 3D milling and turning | Not a 2D contour source |
The short version
A DXF in millimeters, 1:1 in model space, with closed contours and no stray layers, will convert cleanly in almost every CAM package. Fix the source file instead of patching the toolpath.
2D file conversion questions
Can CAM software convert a JPEG into a cut path?
No. A JPEG stores pixels, not geometry, so there are no lines or arcs for the software to offset. Some tools offer auto-trace, but the result approximates your outline and rarely holds a tolerance.
Redraw the part as vectors from dimensions, then export DXF. If the shape is complex, trace it once in CAD and clean the result before cutting.
Why does my DXF import 25.4 times too large?
The DXF header says inches while the geometry was drawn in millimeters, or the opposite. CAM reads the header and scales the numbers accordingly, so a 10 mm feature becomes 10 in.
Fix units in the CAD file, re-export, then measure a known reference line in CAM before generating a toolpath.
Do I need to close contours for a simple profile cut?
Yes, for any pocket, bore, or through-cut that follows a loop. Open geometry stops the offset calculation and the CAM tool may refuse to generate the path.
For a single open line such as a slot centerline, an open polyline is fine, but keep it on a separate layer so it is not mistaken for a cut contour.
What tolerance should I use when converting splines to polylines?
Use a chord tolerance of 0.01 mm or finer for profiles that carry a ±0.005 mm tolerance. Coarser settings flatten curves and push dimensions out of spec.
If the CAM software supports splines directly, import them as splines and skip the conversion. Fewer conversions mean fewer chances to lose accuracy.
How many parts should one DXF contain?
For milling, one part per file keeps work offsets and setup sheets clear. For laser and waterjet, a nested sheet of many parts is normal.
If you send a multi-part sheet for milling, mark each part with its own layer and note the quantity in the drawing notes.
Can you check my 2D file before machining?
Yes. Send the DXF or DWG and we run a DFM review, checking units, contour closure, layer structure, and features that may be hard to hold.
We return the review with the quotation, usually within 12 hours, and note anything that needs correction before production.
Send your 2D file for review
We check units, contour closure, and layer structure before quoting, and reply within 12 hours with a DFM note.
12-hour quoteFree DFM analysisNDA on request