> For the complete documentation index, see [llms.txt](https://monasheng.gitbook.io/zerotohero/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://monasheng.gitbook.io/zerotohero/3d-printing-zero-to-hero/core-skills/stl-export.md).

# STL Export

{% embed url="<https://www.youtube.com/watch?v=J_hzqRp24jI>" %}

## Feature-Based vs Discrete Models

Models that engineers make in CAD are typically *parametric* and *feature-based.* In other words, they comprise mathematical/programmatic expressions (like *extrude this shape* $$X;\text{mm}$$), and can be easily modified. Because they are mathematical, they can also be scaled up/down with no loss of resolution.

Because of the information they encode, editable, feature-based models are typically CAD-program-specific.

To enable easy loading/distribution of CAD files for 3D printing, it is common to discretise feature-based CAD models into *faceted,* surface-only approximations - where the external geometry is represented by a tesselating collection of triangular elements called *facets*. The quality of the approximation is usually directly linked to the number of facets (resolution) of the discretisation.

<figure><img src="/files/dKT8LLKQ6O46oiTFfYfy" alt=""><figcaption><p>Left: an origianl, feature-based CAD model of a sphere, made by revoling a semicircle. Centre, Right: Two faceted approximations made with different facet sizes (resolutions). From: <a href="https://www.makepartsfast.com/what-is-stl/">https://www.makepartsfast.com/what-is-stl/</a></p></figcaption></figure>

In this sense, discretised vs feature-based models are little like raster vs vector images.

## `.stl` Files

The most common type of discretised model used for 3D printing are `.stl` files, which are text-based, lists of facet co-ordinates and surface normal vectors.

Because they are simply text files, `.stl` files are:

* very portable,
* reasonably small, and,
* near-universally compatible with a range of printing softwares.

## STL Export

Most CAD programs have a `.stl` export feature, which allows your to create a discretised model from your feature-based CAD.

### Export is non-associative!

The process of creating a `.stl` is non-associative - that is to say, the process captures an approximation of the feature-based CAD *at the time of export*. The export process typically does not include a link between these models.

This means that any changes to the original CAD will not be mirrored in an exported `.stl` - a discretised model will need to be re-exported after changes are made.

### Settings

Most CAD programs allow you to control a handful of features related to the export of a `.stl`:

#### Units

As `.stl` files do not encode measurement units, you must ensure that your CAD program export and printer program are in agreement with respect to the units assumed in the file. In our part of the world, it is common to export and import assuming $$\text{mm}$$.

{% hint style="danger" %}
:zap: **Warning!** If you mix this up - e.g. exporting in one unit system and importing in another - your model will not print to scale. For instance, exporting in $$\text{mm}$$ and importing in $$\text{m}$$ will lead to a model $$1000\times$$ larger than it should be!

This is usually easy to spot. Be careful of metric/imperial mix-ups however!
{% endhint %}

#### Resolution

In the export process, you can normally tune one or several parameters related to the resolution of your model (size of the facets that make it up).

Some CAD programs allow you to specify a maximum facet edge size or chord length, while others allow you to specify a maximum angle between facets.

In any case, both the fidelity of the approximation and file size of the resulting `.stl` is directly linked to this resolution.&#x20;

While practical limitations on print accuracy mean that there is an upper bound to the benefit of increasing resolution, even very-high-resolution `.stl` files will still be reasonably small (in the order of $$\text{MB}$$). In other words, you can usually afford to export at very high resolution with no practical downsides.

## Further Reading

{% hint style="warning" %}
:books: **Resource:** The 3D printing community is notorious for sharing `.stl` models of printable projects on sites like:

* [Printables](https://www.printables.com/)
* [Thingiverse](https://www.thingiverse.com/)
* [Thangs](https://thangs.com/?sort=likes\&range=week) (this also acts as a "Google" search for`.stl` models across the net)

You should investigate these sites when printing - you might save yourself the trouble of modelling!
{% endhint %}
