3 From Wikipedia, the free encyclopedia
5 Jump to: navigation, search
7 STL is a file format native to the stereolithography CAD software created by 3D
8 Systems. This file format is supported by many other software packages; it is
9 widely used for rapid prototyping and computer-aided manufacturing. STL files
10 describe only the surface geometry of a three dimensional object without any
11 representation of color, texture or other common CAD model attributes. The STL
12 format specifies both ASCII and binary representations. Binary files are more
13 common, since they are more compact.
15 An STL file describes a raw unstructured triangulated surface by the unit
16 normal and vertices (ordered by the right-hand rule) of the triangles using a
17 three-dimensional Cartesian coordinate system.
23 * 3 Colour in Binary STL
24 + 3.1 VisCAM/SolidView
29 * 6 Use in other fields.
35 An ASCII STL file begins with the line:
39 where name is an optional string. The file continues with any number of
40 triangles, each represented as follows:
50 where n1-n3 and v11-v33 are floating point numbers in sign-mantissa'e'-sign-
51 exponent format and concludes with:
55 The structure of the format suggests that other possibilities exist (eg Facets
56 with more than one 'loop' or loops with other than three vertices) but in
57 practice, all facets are simple triangles.
59 White space (spaces, tabs, newlines) may be used anywhere in the file except
60 within numbers or words. The spaces between 'facet' and 'normal' and between
61 'outer' and 'loop' are required.
65 Because ASCII STL files can become very large, a binary version of STL exists.
66 A binary STL file has an 80 character header (which is generally ignored - but
67 which should never begin with 'solid' because that will lead most software to
68 assume that this is an ASCII STL file). Following the header is a 4 byte
69 unsigned integer indicating the number of triangular facets in the file.
70 Following that is data describing each triangle in turn. The file simply ends
71 after the last triangle.
73 Each triangle is described by twelve floating point numbers: three for the
74 normal and then three for the X/Y/Z coordinate of each vertex - just as with
75 the ASCII version of STL. After the twelve floats there is a two byte unsigned
76 'short' integer that is the 'attribute byte count' - in the standard format,
77 this should be zero because most software does not understand anything else.
79 Floating point numbers are represented as IEEE floating point numbers and the
80 endianness is assumed to be little endian although this is not stated in
83 [edit] Colour in Binary STL
85 There are at least two variations on the binary STL format for adding colour
88 [edit] VisCAM/SolidView
90 The VisCAM and SolidView software packages use the two 'attribute byte count'
91 bytes at the end of every triangle to store a 15 bit RGB colour:
93 * bit 0 to 4 are the intensity level for blue (0 to 31)
94 * bits 5 to 9 are the intensity level for green (0 to 31)
95 * bits 10 to 14 are the intensity level for red (0 to 31)
96 + bit 15 is 1 if the colour is valid
97 + bit 15 is 0 if the colour is not valid (as with normal STL files)
101 The Materialise Magics software does things a little differently. It uses the
102 80 byte header at the top of the file to represent the overall colour of the
103 entire part. If colour is used, then somewhere in the header should be the
104 ASCII string "COLOR=" followed by four bytes representing Red, Green, Blue and
105 Alpha channel (transparency) in the range 0-255. This is the colour of the
106 entire object unless overridden at each facet. The per-facet colour is
107 represented in the two 'attribute byte count' bytes as follows:
109 * bit 0 to 4 are the intensity level for red (0 to 31)
110 * bits 5 to 9 are the intensity level for green (0 to 31)
111 * bits 10 to 14 are the intensity level for blue (0 to 31)
112 + bit 15 is 1 if this facet has its own unique colour
113 + bit 15 is 0 if the per-object colour is to be used (or no colour at all
114 if the "COLOR=" string is absent from the header.
118 The red/green/blue ordering within those two bytes is reversed in these two
119 approaches - so whilst these formats could easily have been compatible the
120 reversal of the order of the colours means that they are not - and worse still,
121 a generic STL file reader cannot automatically distinguish between them. There
122 is also no way to have facets be selectively transparent because there is no
123 per-facet alpha value - although in the context of current rapid prototyping
124 machinery, this is not important.
126 [edit] The Facet Normal
128 In both ASCII and binary versions of STL, the facet normal should be a unit
129 vector pointing outwards from the solid object. In most software this may be
130 set to (0,0,0) and the software will automatically calculate a normal based on
131 the order of the triangle vertices using the 'right hand rule'. Some STL
132 loaders (eg the STL plugin for Art of Illusion) check that the normal in the
133 file agrees with the normal they calculate using the right hand rule and warn
134 you when it does not. Other software may ignore the facet normal entirely and
135 use only the right hand rule. So in order to be entirely portable one should
136 provide both the facet normal and order the vertices appropriately - even
137 though it is seemingly redundant to do so.
139 [edit] History of use
141 Stereolithography machines are basically 3D printers that can build any volume
142 shape as a series of slices. Ultimately these machines require a series of
143 closed 2D contours that are filled in with solidified material as the layers
146 The natural file format for such a machine would be a series of closed polygons
147 corresponding to different Z-values. However, since it's possible to vary the
148 layer thicknesses for a faster though less precise build, it seemed easier to
149 define the model to be built as a closed polyhedron that could be sliced at the
150 necessary horizontal levels.
152 The STL file format appears capable of defining a polyhedron with any polygonal
153 facet, but in practice it's only ever used for triangles, which means that much
154 of the syntax of the file is superfluous. It is also the case that the value of
155 the normal shouldn't be necessary, since that is a direct calculation from the
156 coordinates of the triangle with the orientation being controlled by the right
159 STL files are supposed to be closed and connected like a combinatorial surface,
160 where every triangular edge is part of exactly two triangles, and not
161 self-intersecting. Since the syntax does not enforce this property, it can be
162 ignored for applications where the closedness doesn't matter.
164 The closedness only matters insofar as the software which slices the triangles
165 requires it to ensure that the resulting 2D polygons are closed. Sometimes such
166 software can be written to clean up small discrepancies by moving endpoints of
167 edges that are close together so that they coincide. The results are not
168 predictable, but it is often sufficient to get the job done.
170 Obviously, there is much scope for "improvement" of this file format, which in
171 its present form is nothing more than a listing of groups of 9 (or 12 if you
172 care about the normals) floating point numbers embedded in some unnecessary
173 syntax. Since each vertex is on average going to be used in six different
174 triangles, considerable savings in memory could be obtained by listing all the
175 points in a table at the beginning of the file, and concluding with a list of
176 triangle definitions composed of triplets of integers that referenced this
179 However, for the purpose of generating a single contour slice using a very
180 lightweight piece of software on a computer with little memory, this format is
181 perfect since it can be processed in one pass regardless of file size.
183 [edit] Use in other fields.
185 Many Computer-aided design systems are able to output the STL file format among
186 their other formats because it's quick and easy to implement, if you ignore the
187 connection criteria of the triangles. Many Computer-aided manufacturing systems
188 require triangulated models as the basis of their calculation.
190 Since an STL file output, of a sorts, is almost always available from the CAD
191 system, it's often used as a quick method for importing the necessary
192 triangulated geometry into the CAM system.
194 Once it works, there is very little motivation to change, even though it is far
195 from the most memory and computationally efficient method for transferring this
196 data. Many integrated CAD and CAM systems transfer their geometric data using
197 this accidental file format, because it's impossible to go wrong.
199 There are many other file formats capable of encoding triangles available, such
200 as VRML, DXF, but they have the disadvantage that it's possible to put things
201 other than triangles into it, and thus produce something ambiguous or unusable.
205 * RepRap is an OpenSource project that uses STL file input and generates
206 solid objects as output.
207 * PLY (file format) is an alternative file format with more flexibility that
208 is in use in some stereolithography applications.
209 * MeshLab is an open source Windows and Linux application for visualizing,
210 processing and converting three dimensional meshes to or from the STL file
213 [edit] External links
215 * The STL Format - Standard Data Format for Fabbers: The STL Format
216 * How to Create an STL file Guide to exporting STL files from various CAD
217 packages (courtesy of ProtoCAM)
218 * SolidView SolidView is a commercial STL manipulation package that has a
219 Lite version available (under provision of a business email address) for
221 * Freesteel with a web-interface where you can upload an STL file and render
222 it into an image in your browser.
223 * ADMesh is a GPLed text-based program for processing triangulated solid
224 meshes, and reads and writes the STL file format.
226 Retrieved from "http://en.wikipedia.org/wiki/STL_%28file_format%29"
228 Categories: Solid freeform fabrication | CAD file formats | Graphics file
229 formats | Computer file formats | 3D computer graphics
240 * Log in / create account
258 * Donate to Wikipedia
283 * This page was last modified 22:47, 15 February 2008.
284 * All text is available under the terms of the GNU Free Documentation License
285 . (See Copyrights for details.)
286 Wikipedia? is a registered trademark of the Wikimedia Foundation, Inc., a
287 U.S. registered 501(c)(3) tax-deductible nonprofit charity.