An StL file consists of a list of facet data. Each facet is uniquely identified by a unit normal (a line perpendicular to the triangle and with a length of 1.0) and by three vertices (corners). The normal and each vertex are specified by three coordinates each, so there is a total of 12 numbers stored for each facet.
|Figure 1. Orientation of a facet is determined by the direction of the unit normal and the order in which the vertices are listed.|
Facet orientation. The facets define the surface of a 3-dimensional object. As such, each facet is part of the boundary between the interior and the exterior of the object. The orientation of the facets (which way is out and which way is in) is specified redundantly in two ways which must be consistent. First, the direction of the normal is outward. Second, the vertices are listed in counterclockwise order when looking at the object from the outside (right-hand rule). These rules are illustrated in Figure 1.
Vertex-to-vertex rule. Each triangle must share two vertices with each of its adjacent triangles. In other words, a vertex of one triangle cannot lie on the side of another. This is illustrated in Figure 2.
|Figure 2. The vertex-to-vertex rule. The left figure shows a violation of the rule. A correct configuration is shown on the right.|
The object represented must be located in the all-positive octant. In other words, all vertex coordinates must be positive-definite (nonnegative and nonzero) numbers. The StL file does not contain any scale information; the coordinates are in arbitrary units.
The official 3D Systems StL specification document states that there is a provision for inclusion of special attributes for building parameters, but does not give the format for including such attributes. Also, the document specifies data for the minimum length of triangle side and maximum triangle size, but these numbers are of dubious meaning.
Sorting the triangles in ascending z-value order is recommended, but not required, in order to optimize performance of the slice program.
Typically, an StL file is saved with the extension StL, case-insensitive. The slice program may require this extension or it may allow a different extension to be specified.
The StL standard includes two data formats, ASCII and binary. These are described separately below.