STL (file format)

STL (file format)

Infobox file format
name = STL
icon =

caption =
extension = .stl
mime =
type code =
uniform type =
magic =
owner = 3D Systems
released =
latest release version =
latest release date =
genre = Stereolithography
container for =
contained by =
extended from =
extended to =
standard =
url =

STL is a file format native to the stereolithography CAD software created by 3D Systems. This file format is supported by many other software packages; it is widely used for rapid prototyping and computer-aided manufacturing. STL files describe only the surface geometry of a three dimensional object without any representation of color, texture or other common CAD model attributes. The STL format specifies both ASCII and binary representations. Binary files are more common, since they are more compact.

An STL file describes a raw unstructured triangulated surface by the unit normal and vertices (ordered by the right-hand rule) of the triangles using a three-dimensional Cartesian coordinate system.


An ASCII STL file begins with the line:

solid "name"

where "name" is an optional string. The file continues with any number of triangles, each represented as follows:

facet normal "n1 n2 n3" outer loop vertex "v11 v12 v13" vertex "v21 v22 v23" vertex "v31 v32 v33" endloop endfacet

where n1-n3 and v11-v33 are floating point numbers in sign-mantissa'e'-sign-exponent format and concludes with:

endsolid "name"

The structure of the format suggests that other possibilities exist (eg Facets with more than one 'loop' or loops with other than three vertices) but in practice, all facets are simple triangles.

White space (spaces, tabs, newlines) may be used anywhere in the file except within numbers or words. The spaces between 'facet' and 'normal' and between 'outer' and 'loop' are required.

Binary STL

Because ASCII STL files can become very large, a binary version of STL exists. A binary STL file has an 80 character header (which is generally ignored - but which should never begin with 'solid' because that will lead most software to assume that this is an ASCII STL file). Following the header is a 4 byte unsigned integer indicating the number of triangular facets in the file. Following that is data describing each triangle in turn. The file simply ends after the last triangle.

Each triangle is described by twelve 32-bit-floating point numbers: three for the normal and then three for the X/Y/Z coordinate of each vertex - just as with the ASCII version of STL. After the twelve floats there is a two byte unsigned 'short' integer that is the 'attribute byte count' - in the standard format, this should be zero because most software does not understand anything else.

Floating point numbers are represented as IEEE floating point numbers and the endianness is assumed to be little endian although this is not stated in documentation.

Colour in Binary STL

There are at least two variations on the binary STL format for adding colour information:


The VisCAM and SolidView software packages use the two 'attribute byte count' bytes at the end of every triangle to store a 15 bit RGB colour:

* bit 0 to 4 are the intensity level for blue (0 to 31)
* bits 5 to 9 are the intensity level for green (0 to 31)
* bits 10 to 14 are the intensity level for red (0 to 31)
** bit 15 is 1 if the colour is valid
** bit 15 is 0 if the colour is not valid (as with normal STL files)


The Materialise Magics software does things a little differently. It uses the 80 byte header at the top of the file to represent the overall colour of the entire part. If colour is used, then somewhere in the header should be the ASCII string "COLOR=" followed by four bytes representing Red, Green, Blue and Alpha channel (transparency) in the range 0-255. This is the colour of the entire object unless overridden at each facet. The per-facet colour is represented in the two 'attribute byte count' bytes as follows:

* bit 0 to 4 are the intensity level for red (0 to 31)
* bits 5 to 9 are the intensity level for green (0 to 31)
* bits 10 to 14 are the intensity level for blue (0 to 31)
** bit 15 is 0 if this facet has its own unique colour
** bit 15 is 1 if the per-object colour is to be used


The red/green/blue ordering within those two bytes is reversed in these two approaches - so whilst these formats could easily have been compatible the reversal of the order of the colours means that they are not - and worse still, a generic STL file reader cannot automatically distinguish between them. There is also no way to have facets be selectively transparent because there is no per-facet alpha value - although in the context of current rapid prototyping machinery, this is not important.

The Facet Normal

In both ASCII and binary versions of STL, the facet normal should be a unit vector pointing outwards from the solid object. In most software this may be set to (0,0,0) and the software will automatically calculate a normal based on the order of the triangle vertices using the 'right hand rule'. Some STL loaders (eg the STL plugin for Art of Illusion) check that the normal in the file agrees with the normal they calculate using the right hand rule and warn you when it does not. Other software may ignore the facet normal entirely and use only the right hand rule. So in order to be entirely portable one should provide both the facet normal and order the vertices appropriately - even though it is seemingly redundant to do so.

History of use

Stereolithography machines are basically 3D printers that can build any volume shape as a series of slices. Ultimately these machines require a series of closed 2D contours that are filled in with solidified material as the layers are fused together.

The natural file format for such a machine would be a series of closed polygons corresponding to different Z-values. However, since it's possible to vary the layer thicknesses for a faster though less precise build, it seemed easier to define the model to be built as a closed polyhedron that could be sliced at the necessary horizontal levels.

The STL file format appears capable of defining a polyhedron with any polygonal facet, but in practice it's only ever used for triangles, which means that much of the syntax of the file is superfluous. It is also the case that the value of the normal shouldn't be necessary, since that is a direct calculation from the coordinates of the triangle with the orientation being controlled by the right hand rule.

STL files are supposed to be closed and connected like a combinatorial surface, where every triangular edge is part of exactly two triangles, and not self-intersecting. Since the syntax does not enforce this property, it can be ignored for applications where the closedness doesn't matter.

The closedness only matters insofar as the software which slices the triangles requires it to ensure that the resulting 2D polygons are closed. Sometimes such software can be written to clean up small discrepancies by moving endpoints of edges that are close together so that they coincide. The results are not predictable, but it is often sufficient to get the job done.

Obviously, there is much scope for "improvement" of this file format, which in its present form is nothing more than a listing of groups of 9 (or 12 if you care about the normals) floating point numbers embedded in some unnecessary syntax. Since each vertex is on average going to be used in six different triangles, considerable savings in memory could be obtained by listing all the points in a table at the beginning of the file, and concluding with a list of triangle definitions composed of triplets of integers that referenced this table.

However, for the purpose of generating a single contour slice using a very lightweight piece of software on a computer with little memory, this format is perfect since it can be processed in one pass regardless of file size.

Use in other fields.

Many Computer-aided design systems are able to output the STL file format among their other formats because it's quick and easy to implement, if you ignore the connection criteria of the triangles. Many Computer-aided manufacturing systems require triangulated models as the basis of their calculation.

Since an STL file output, of a sorts, is almost always available from the CAD system, it's often used as a quick method for importing the necessary triangulated geometry into the CAM system.

It can also be used for interchanging data between CAD/CAM systems and computational environments such as Mathematica.

Once it works, there is very little motivation to change, even though it is far from the most memory and computationally efficient method for transferring this data. Many integrated CAD and CAM systems transfer their geometric data using this accidental file format, because it's impossible to go wrong.

There are many other file formats capable of encoding triangles available, such as VRML, DXF, but they have the disadvantage that it's possible to put things other than triangles into it, and thus produce something ambiguous or unusable.

ee also

* RepRap is an OpenSource project that uses STL file input and generates solid objects as output.
* PLY (file format) is an alternative file format with more flexibility that is in use in some stereolithography applications.
* MeshLab is an open source Windows and Linux application for visualizing, processing and converting three dimensional meshes to or from the STL file format.

External links

* The STL Format - Standard Data Format for Fabbers: [ The STL Format]
* [ How to Create an STL file] Guide to exporting STL files from various CAD packages (courtesy of ProtoCAM)
* [ SolidView] SolidView is a commercial STL manipulation package that has a Lite version available (under provision of a business email address) for STL viewing.
* [ ADMesh] is a GPLed text-based program for processing triangulated solid meshes, and reads and writes the STL file format.
* GLC_Player is a GPL software used to view 3d models in OBJ, 3DS, STL and OFF Format and to navigate easily in these models.

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • PLY (file format) — PLY is a computer file format known as the Polygon File Format or the Stanford Triangle Format.The format was principally designed to store three dimensional data from 3D scanners. It supports a relatively simple description of a single object as …   Wikipedia

  • STL — may refer to:;In communications: *Standard telegraph level *Studio/transmitter link;In the economics: *Software Technologies Laboratory, a private company in Blacksburg, Virginia; originally part of Virginia Tech *Standard Telecommunication… …   Wikipedia

  • STL (формат файла) — STL Расширение .stl MIME application/sla [1] Разработан 3D Systems Опубликован 1987[2] Тип формата 3д модели Стандар …   Википедия

  • STL — St. Louis (Governmental » State & Local) * St Louis Rams (Miscellaneous » NFL Teams) * Standard Template Library (Computing » General) * Standard Template Library (Computing » Software) * Lambert St Louis International Airport (Governmental »… …   Abbreviations dictionary

  • List of file formats — This is an incomplete list, which may never be able to satisfy particular standards for completeness. You can help by expanding it with reliably sourced entries. See also: List of file formats (alphabetical) This is a list of file formats… …   Wikipedia

  • Wavefront .obj file — For other uses, see Obj (disambiguation). OBJ geometry format Filename extension .obj Internet media type application/x tgif? Developed by Wavefront Technologies Type of format 3D model format OBJ (or .OBJ) is a ge …   Wikipedia

  • Design Web Format — Filename extension .dwf, .dwfx Developed by Autodesk Type of format CAD Design Web Format (DWF) is a secure file format developed by Autodesk for the efficient distribution and communication of rich design data to anyone who needs to view, review …   Wikipedia

  • List of file systems — The following lists identify, characterize and link to more thorough information on computer file systems.Many older operating systems support only their one native file system, which does not bear any name apart from the name of the operating… …   Wikipedia

  • Comparison of CAD, CAM and CAE file viewers — Computer aided design (CAD), Computer aided engineering (CAE) and Computer aided manufacturing (CAM) software produces files in a large variety of formats many of which are extremely complex and poorly supported by other applications. This… …   Wikipedia

  • List of computer-aided design editors — Advanced 3D CAD software allows users to create complex 3D forms This page compares computer aided design (CAD) software that engineers and architects use to create drawings for the fields of architecture, engineering and construction (AEC) in… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.