DXF to OpenSCAD: turn CAD outlines into editable code
OpenSCAD can reference a DXF, but that DXF then has to stay next to your project file and be available everywhere the design renders. The moment you want to share one self-contained .scad - on MakerWorld, in a repo, with a friend - the external dependency becomes a problem.
This converter reads your 2D DXF and emits native OpenSCAD polygon() arrays wrapped in linear_extrude(). The result is one editable, previewable, shareable file with the CAD outline baked in as real geometry.
After conversion, preview your converted file in the OpenSCAD Viewer or keep refining it in the OpenSCAD Playground.
How the converter works
The converter parses the drawing, picks out supported 2D outline geometry, flattens curves into line segments, and writes OpenSCAD point and path arrays. Closed polylines become printable regions; circles convert into polygon contours with enough facets to preview cleanly. Contours nested inside other contours become holes, which keeps cutouts, internal openings, and plate-style profiles intact through the conversion.
Preparing a DXF for OpenSCAD
Closed polylines are the ideal input - they already describe exactly the shape that should become geometry. Circles work too, and curved polyline segments are flattened according to the curve smoothness setting.
Drawings exported from Fusion 360, AutoCAD, Illustrator, Inkscape, or LightBurn frequently carry baggage: construction lines, dimensions, text, hatches, blocks, hidden layers. None of it means anything to OpenSCAD. If the preview looks wrong, join your outlines into closed loops, delete the reference geometry, and export a clean 2D DXF.
When this tool is a good fit
Use it when the DXF is a flat 2D profile you want as a printable object - plates, signs, inserts, simple brackets, templates, tags, badges. It's also the bridge for getting real CAD geometry into a parametric OpenSCAD project: once converted, the outline can be combined with cylinders, screw holes, standoffs, text, and tolerances like any native module.
Current limitations
This converter focuses on clean 2D outlines. It doesn't import 3D CAD models, evaluate blocks, preserve dimensions, convert text to paths, process hatches, or clean up messy overlapping geometry. If the preview looks wrong, simplify the DXF and try again.
DXF to OpenSCAD FAQ
Why convert instead of importing the DXF in OpenSCAD?
Importing keeps a permanent external file dependency. Converted polygon code is self-contained - one .scad file that works anywhere, including online customizers that can't resolve external files.
My DXF converts to nothing or to fragments. Why?
Almost always open outlines. The converter needs closed polylines to know what's inside versus outside. Join your line segments into closed loops in your CAD tool and re-export.
Can I convert a Fusion 360 sketch?
Yes - export the sketch as DXF from Fusion, clean out construction geometry and dimensions, and convert. Sketch profiles made of closed loops come through well.
