# How to export STL from OpenSCAD

Press F6 to render the full model, wait until it finishes, then choose File > Export > Export as STL. F5 only makes a preview.

## Export the model

1. Press **F5** for a quick preview.
2. Press **F6** for a full render.
3. Wait for the render to finish and read the console.
4. Choose **File > Export > Export as STL**.
5. Check its size in a viewer.

OpenSCAD numbers have no built-in unit, but 3D printing users normally use one unit as one millimeter.

## Make curves smooth

Use the largest angle `$fa` and smallest segment size `$fs`:

```
$fa = 5;
$fs = 0.4;
cylinder(h = 20, r = 5);
```

This lets small curves use enough segments without giving every large curve the same number. `$fn` sets a fixed count. A high value for every small object can make rendering slow.

## Avoid touching faces

When one object cuts another, extend the cutter slightly past both faces:

```
difference() {
  cube([20, 20, 5]);
  translate([10, 10, -0.01]) cylinder(h = 5.02, r = 3);
}
```

The extra 0.01 avoids two faces in exactly the same place. If two solids should be joined, overlap them and use `union()`.

## Questions

### Why is Export disabled?

Render the model with F6 first. Also check the console for an error or an empty result.

### Can I export from the command line?

Yes. `openscad -o part.stl part.scad` writes an STL from the SCAD file. The command may need its full path on your computer.

Source: https://stlviewer3d.com/guides/export-stl-from-openscad/
