chiark / gitweb /
better with more bendingness costs
[moebius2.git] / stl-format-wikipedia.txt
1 STL (file format)
2
3 From Wikipedia, the free encyclopedia
4
5 Jump to: navigation, search
6
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.
14
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.
18
19 Contents
20
21   * 1 ASCII STL
22   * 2 Binary STL
23   * 3 Colour in Binary STL
24       + 3.1 VisCAM/SolidView
25       + 3.2 Magics
26       + 3.3 NOTE:
27   * 4 The Facet Normal
28   * 5 History of use
29   * 6 Use in other fields.
30   * 7 See also
31   * 8 External links
32
33 [edit] ASCII STL
34
35 An ASCII STL file begins with the line:
36
37  solid name
38
39 where name is an optional string. The file continues with any number of
40 triangles, each represented as follows:
41
42  facet normal n1 n2 n3
43    outer loop
44      vertex v11 v12 v13
45      vertex v21 v22 v23
46      vertex v31 v32 v33
47    endloop
48  endfacet
49
50 where n1-n3 and v11-v33 are floating point numbers in sign-mantissa'e'-sign-
51 exponent format and concludes with:
52
53  endsolid name
54
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.
58
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.
62
63 [edit] Binary STL
64
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.
72
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.
78
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
81 documentation.
82
83 [edit] Colour in Binary STL
84
85 There are at least two variations on the binary STL format for adding colour
86 information:
87
88 [edit] VisCAM/SolidView
89
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:
92
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)
98
99 [edit] Magics
100
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:
108
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.
115
116 [edit] NOTE:
117
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.
125
126 [edit] The Facet Normal
127
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.
138
139 [edit] History of use
140
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
144 are fused together.
145
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.
151
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
157 hand rule.
158
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.
163
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.
169
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
177 table.
178
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.
182
183 [edit] Use in other fields.
184
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.
189
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.
193
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.
198
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.
202
203 [edit] See also
204
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
211     format.
212
213 [edit] External links
214
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
220     STL viewing.
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.
225
226 Retrieved from "http://en.wikipedia.org/wiki/STL_%28file_format%29"
227
228 Categories: Solid freeform fabrication | CAD file formats | Graphics file
229 formats | Computer file formats | 3D computer graphics
230
231 Views
232
233   * Article
234   * Discussion
235   * Edit this page
236   * History
237
238 Personal tools
239
240   * Log in / create account
241
242  
243
244 Navigation
245
246   * Main Page
247   * Contents
248   * Featured content
249   * Current events
250   * Random article
251
252 Interaction
253
254   * About Wikipedia
255   * Community portal
256   * Recent changes
257   * Contact Wikipedia
258   * Donate to Wikipedia
259   * Help
260
261 Search
262
263 [                    ] [Go]  [Search]
264 Toolbox
265
266   * What links here
267   * Related changes
268   * Upload file
269   * Special pages
270   * Printable version
271   * Permanent link
272   * Cite this page
273
274 Languages
275
276   * Deutsch
277   * Fran?ais
278   * ???????
279
280 Powered by MediaWiki
281 Wikimedia Foundation
282
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.
288   * Privacy policy
289   * About Wikipedia
290   * Disclaimers
291