STL (.stl)

MIME type: application/sla
STL computer-aided design and manufacturing format.
3D geometry format.
Commonly used for representing solid models in rapid prototyping systems.
Native format of the 3D Systems stereolithography CAD software.
Developed in 1989 by 3D Systems, Inc.
STL is an acronym derived from stereolithography.
ASCII or binary format.
Binary STL files store data using little-endian byte ordering.
Stores a solid 3D object as a surface formed by a collection of adjacent triangles.
Does not store color information.

Import and ExportImport and Export

  • Import["file.stl"] imports an STL file as a Graphics3D object.
  • Export["file.stl", expr] exports a Graphics3D expression to a binary STL file.
  • Import["file.stl"] returns an expression of the form Graphics3D[ GraphicsComplex[vertices, primitives, opts]].
  • Export["file.stl", Graphics3D[...]] creates an STL file representing a solid physical model.
  • Import["file.stl", elem] imports the specified element from an STL file.
  • Import["file.stl", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.stl", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "STL"] or Import["file", {"STL", elem, ...}].
  • Export["file.stl", expr, elem] creates a binary STL file by treating expr as specifying element elem.
  • Export["file.stl", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each as specifying the corresponding .
  • Export["file.stl", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.stl", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the STL format.

ElementsElements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Graphics3D"STL file represented as a Graphics3D object
    "GraphicsComplex"STL file as a GraphicsComplex object
    "PolygonData"the polygon elements in indexed form
    "PolygonObjects"list of Polygon primitives given in absolute coordinates
    "VertexData"list of vertex coordinates
  • Import and Export use the element by default for STL files.
  • The element corresponds to the first argument of GraphicsComplex.
  • Advanced Import element:
  • "BinaryFormat"whether the file is a binary or ASCII STL

OptionsOptions

  • General Import options:
  • ImageSizeAutomaticspecifies the overall size of the graphics to display
    BackgroundAutomaticspecifies what background color to use
  • Export options:
  • "BinaryFormat"Truewhether to write a binary or ASCII file
    "SurfaceOrientation"Automaticspecifies how triangles should be oriented
  • Possible settings for are:
  • Automaticspecifies no orientation
    {x,y,z}triangle faces are oriented toward the given point
    Infinitytriangles face away from the origin of the coordinate system

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Import a 3D model from STL and render it as Graphics3D:

In[1]:=
Click for copyable input
Out[1]=

Show the Import elements available in this file:

In[2]:=
Click for copyable input
Out[2]=

Test whether this file is a binary or ASCII STL:

In[3]:=
Click for copyable input
Out[3]=

Read the vertex coordinates represented in this file:

In[4]:=
Click for copyable input
Out[4]=

Construct a 3D model based on the evolution of a cellular automaton:

In[1]:=
Click for copyable input
Out[1]=

Export it to STL:

In[2]:=
Click for copyable input
Out[2]=

Import this file, rendering the model against a dark background:

In[3]:=
Click for copyable input
Out[3]=
New in 4.1 | Last modified in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »