The .stl or stereolithography format is an ASCII or binary file used in manufacturing. It is a list of the triangular surfaces that describe a computer generated solid model. This is the standard input for most rapid prototyping machines.
The ASCII .stl file must start with the lower case keyword solid and end with endsolid. Within these keywords are listings of individual triangles that define the faces of the solid model. Each individual triangle description defines a single normal vector directed away from the solid's surface followed by the xyz components for all three of the vertices. These values are all in Cartesian coordinates and are floating point values. The triangle values should all be positive and contained within the building volume. For this project the values are 0 to 14 inches in x, 0 to 10 in the y and 0 to 12 in the z. This is the maximum volume that can be built but the models should be scaled or rotated to optimize construction time, strength and scrap removal. The normal vector is a unit vector of length one based at the origin. If the normals are not included then most software will generate them using the right hand rule. If the normal information is not included then the three values should be set to 0.0. Below is a sample ASCII description of a single triangle within an STL file.
facet normal 0.00 0.00 1.00 outer loop vertex 2.00 2.00 0.00 vertex -1.00 1.00 0.00 vertex 0.00 -1.00 0.00 endloop endfacet ... endsolid
The most common error in an STL file is non compliance with the vertex-to-vertex rule. The STL specifications require that all adjacent triangles share two common vertices. This is illustrated in figure 1. The figure on the left shows a top triangle containing a total of 4 vertex points. The outer vertices of the top triangle are not shared with and one other single triangle. The lower 2 triangles each contain one of the points as well as the fourth invalid vertex point. To make this valid under the vertex to vertex rule the top triangle must be subdivided as in the example on the right.
TMF Repository - Sample STL files