# How do slicers convert an STL file to G-Code?

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

• 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 Jul 19 '20 at 12:52
• i am sorry, I couldn't find a better tag than any random slicer – Ryan George Jul 19 '20 at 13:52

# 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.

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.