Tuesday 13 August 2013

Anatomy of an STL File

Quick Summary of main points on this post:


  • STL files desicribe a mesh of triangles with no other information.
  • STL files to not contain unit information
  • STL files do not contain colour information*
  • Some applications always export STL files in feet or inches
  • 2 types of STL file - Always choose Binary as it makes smaller files.

STL is sometimes called Stereolithography Format or more properly Standard Tessellation Language. It has become the default file format for many single colour 3D printing applications. It was developed by Chuck Hull soon after he built the first 3D printer and the first specification was released in 1988.

Below is an example of the contents of an ASCII STL file that partially describes a cube drawn with one corner at the origin and with sides of length 1 unit. It is worth pointing out that there are two types of file STL format: binary and ASCII. They contain exactly the same information but the ASCII files will be much larger as they contain human readable text while the binary file is essentially a compressed version.

It can be seen that the contents of the STL file is very simple, it is essentially a list of coordinates that describe triangles and the normal that describes which direction each triangle faces. STL files describe a mesh of triangles with no other information. When exporting STL files, vector and nurbs based software may ask for a tolerance which is used to calculate how many triangles are needed to describe curved surfaces. Generally, the lower the tolerance the closer the triangles match the curve of the geometry and the more are required to create the form and so the large the file becomes.

One important thing to understand about an STL file is that it does not contain any information on what units are being used. The units used in any particular file will be determined by the software that was used to export the STL file. Usually the units will reflect the units that were used to model the geometry so if the model was modelled in meters the units will be meters, if the model was modelled in mm the units will be mm. However some software and export plugins that were written in the US may default all exported STL files to inches or possibly even feet.

solid
  facet normal -1.000000e+000 -0.000000e+000 -0.000000e+000
    outer loop
      vertex 0.000000e+000 0.000000e+000 1.000000e+000
      vertex 0.000000e+000 1.000000e+000 1.000000e+000
      vertex 0.000000e+000 1.000000e+000 0.000000e+000
    endloop
  endfacet
  facet normal -1.000000e+000 0.000000e+000 0.000000e+000
    outer loop
      vertex 0.000000e+000 1.000000e+000 0.000000e+000
      vertex 0.000000e+000 0.000000e+000 0.000000e+000
      vertex 0.000000e+000 0.000000e+000 1.000000e+000
    endloop
  endfacet
  facet normal 0.000000e+000 1.000000e+000 0.000000e+000
    outer loop
      vertex 0.000000e+000 1.000000e+000 1.000000e+000
      vertex 1.000000e+000 1.000000e+000 1.000000e+000
      vertex 1.000000e+000 1.000000e+000 0.000000e+000
    endloop
  endfacet

.....................................

  facet normal 0.000000e+000 0.000000e+000 -1.000000e+000
    outer loop
      vertex 0.000000e+000 0.000000e+000 0.000000e+000
      vertex 0.000000e+000 1.000000e+000 0.000000e+000
      vertex 1.000000e+000 1.000000e+000 0.000000e+000
    endloop
  endfacet
endsolid


In the future the STL file format is likely to be around for some years to come but in time it is likely that the format will be replaced by something like the AMF (Additive Manufacturing Format). Intitially known as STL 2, AMF is being designed on the XML (Extensible Markup Language) platform which means that it is flexible and can contain both geometry and additional information such as multiple materials and colours etc.

Since writing this in August 2013 a consortium of industry leaders has been formed to develop a new format known as 3MF. AMF has been pretty much dropped even though it became a viable format. As of March 2016 we have still not received an AMF file or had any enquiry about this format. 

These new formats are attempting to address the needs of 3D printing, additive manufacturing, copyright issues and other rights to reproduce. It is going to be complex and less accessible - I for one appreciate the simplicity of the STL file. "Simple is efficient" as my engineering drawing teacher used to say.

*In fact binary STL can support colour, if we save an STL from Magics we can open it again in Magics preserving the colour information. However the important point is that all of the STL file exporters written for 3D modelling software like Rhino, Revit, MicroStation, SketchUp etc do not export colour.


For further information about Lee 3D visit www.lee3d.co.uk







No comments:

Post a Comment