Svg to stl using scad

Jozdowska Edyta · 30 Kwiecień 2025

Short review

1. Prepare the outline in Inkscape

  1. Open the SVG file
    • File → Open, select file.svg.
  2. Add a stroke
    • Select the object.
    • Open the Fill and Stroke dialog (Shift + Ctrl + F).
    • In the Stroke Style tab, set the Width (e.g., 2 px).
  3. Convert the stroke to a path - form main menu
    • Path → Stroke to Path or use (CTRL + Alt + C)

2. Export to DXF (AutoCAD R14)

  1. Select the resulting path.
  2. File → Save As…
  3. Choose Desktop Cutting Plotter (AutoCAD R14) (*.dxf).
  4. Save as file.dxf in the same folder as your .scad script.

3. Install OpenSCAD

Linux (Ubuntu/Debian)

1
2
sudo apt update
sudo apt install openscad

Windows

Visit: https://openscad.org/downloads.html

Download the MSI installer and run it.

4. Import the DXF and generate the model in OpenSCAD

Create a file dfx-to-stl.scad with the following content:

$fn = 100;

module stl_from_dxf(extrude_height = 5) {
    linear_extrude(
        height      = extrude_height,
        center      = false,
        convexity   = 10
    )
        import("file.dxf");
}

// Example: 20 mm extrusion height
stl_from_dxf(20);

where:

  • $fn = 100; — smoothness of curves and edges.
  • extrude_height — extrusion height in millimeters.

5. Export to STL

  1. In OpenSCAD, choose Design → Compile and Render (CGAL) (F6).
  2. After rendering, select File → Export → Export as STL.
  3. Save as result.stl.

That all :smile:

Jozdowska Edyta * FullStack Developer

Pisanie kodu jest moją pasją. Zajmuję się tym od przeszło 10 lat, z większą lub mniejszą intensywnością.
Piszę kod w PHP, JS, SCSS i Python. Nie stronię też od poznawania nowych, lub jak kto woli starych rozwiązań jak Jekyll oraz innych języków np. Java.

więcej o mnie