<h1>Slicing in General</h1>
<p>An STL is a set of triangle surfaces. A Watertight STL - for slicing purposes - has surfaces that always create closed outlines if cut parallel to the XY plane.</p>
<p>A Slicer does exactly that: it creates plane-cuts at the indicated Z-heights, takes the plane-cut's outline(s), and decides a direction and order in which to follow the generated path. Then it uses this outline to generate the infill pattern, for example, as explained <a href="https://3dprinting.stackexchange.com/questions/6832/how-are-infill-paths-connect-to-form-an-efficient-path-that-respect-the-objects/6836#6836">here.</a></p>
<p>The more paths there are and the smaller the triangles that are cut up, the more complex the solution process becomes and the longer it takes.</p>
<h1>Support calculation</h1>
<p>A slicer usually identifies areas that need support by calculating at which angle an STL Surface cuts a given plane cut. Under standard settings, this would be about less than 60° to the XY-plane with the normal of the surface having a negative Z-component - which means that a needle poking out of that surface points towards the bed.</p>
<p>The most simple form of support generation simply generates a grid pattern between such areas and the bed or next surface below. Tree support on the other tries to generate a support structure that bends around the object without intersecting and only relying on the support of itself.</p>
<h1>Build Plate adhesion</h1>
<p>A skirt and brim are just taking the outline of the build-plate intersection and surround that with outlines.</p>
<p>A Raft is generated like the simple support case, but taking the whole base of the object, adding a little edge around it and then generating the support grid there.</p>

CC BY-SA 4.0
2020-07-19T12:51:08.743Z
2020-07-19T19:06:35.053Z
2020-07-19T19:06:35.053Z
Trish
<p>I was wondering how slicers work, how their code runs to generate a G-Code file. How is an STL file interpreted through a slicer.</p>
<p>How does the math work for generating supports, build plate adhesion?</p>
<p>I couldn't find any information, so can anyone help with this technical question</p>
<p>Ryan</p>

CC BY-SA 4.0
2020-07-19T12:52:19.660Z
This doesn't seem to have anything to do with the firmware (marlin) or a specific slicer (Ultimker Cura) but with slicing in general.
Trish
<slicing>
How do slicers convert an STL file to G-Code?
ConvergingPanda
# How do slicers convert an STL file to G-Code?

(Asked by: username_0 on 2020-07-19)

I was wondering how slicers work, how their code runs to generate a G-Code file. How is an STL file interpreted through a slicer.

How does the math work for generating supports, build plate adhesion?

I couldn't find any information, so can anyone help with this technical question

Ryan

**Tags:** slicing

> **Comments:**
> **username_1**: This doesn't seem to have anything to do with the firmware (marlin) or a specific slicer (Ultimker Cura) but with slicing in general.  

---

## 1 answers

### Answer by username_1 on 2020-07-19. Score: 6 | Accepted answer

# Slicing in General

An STL is a set of triangle surfaces. A Watertight STL - for slicing purposes - has surfaces that always create closed outlines if cut parallel to the XY plane.

A Slicer does exactly that: it creates plane-cuts at the indicated Z-heights, takes the plane-cut's outline(s), and decides a direction and order in which to follow the generated path. Then it uses this outline to generate the infill pattern, for example, as explained [here.](https://3dprinting.stackexchange.com/questions/6832/how-are-infill-paths-connect-to-form-an-efficient-path-that-respect-the-objects/6836#6836)

The more paths there are and the smaller the triangles that are cut up, the more complex the solution process becomes and the longer it takes.

# Support calculation

A slicer usually identifies areas that need support by calculating at which angle an STL Surface cuts a given plane cut. Under standard settings, this would be about less than 60° to the XY-plane with the normal of the surface having a negative Z-component - which means that a needle poking out of that surface points towards the bed.

The most simple form of support generation simply generates a grid pattern between such areas and the bed or next surface below. Tree support on the other tries to generate a support structure that bends around the object without intersecting and only relying on the support of itself.

# Build Plate adhesion

A skirt and brim are just taking the outline of the build-plate intersection and surround that with outlines.

A Raft is generated like the simple support case, but taking the whole base of the object, adding a little edge around it and then generating the support grid there.


---

