STL (.stl)
Background & Context
-
- 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.
- Stores a 3D object, including solid, as a surface formed by a collection of adjacent triangles.
Import & Export
- Import["file.stl"] imports an STL file as a MeshRegion object representing the surface.
- Import["file.stl",elem] imports the specified element from an STL file.
- The import format can be specified with Import["file","STL"] or Import["file",{"STL",elem,…}].
- Export["file.stl",expr] exports a 3D mesh-based geometric region to a binary STL file. The expr can be any region that is ConstantRegionQ or a Graphics3D object.
- The export format can be specified with Export["file",expr,"STL"] or Export["file",expr,{"STL",opt1->val1,…}].
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Rules" list of rules for all available elements "Summary" summary of the file "CoordinateTransform" transformation function from STL format - Data format representation elements:
-
"BinaryFormat" whether the file is a binary or ASCII STL "Comments" comments "VertexData" list of vertex coordinates "PolygonData" list of polygon elements in indexed form "PolygonCount" number of polygons - Geometry representation elements:
-
"BoundaryMeshRegion" boundary mesh representation of a solid "MeshRegion" mesh representation of a surface "Region" region representation of a surface - Graphics representation elements:
-
"Graphics3D" STL file represented as a Graphics3D object "GraphicsComplex" STL file as a GraphicsComplex object "PolygonObjects" list of polygon primitives in absolute coordinates - Import and Export use the "MeshRegion" element by default for STL files.
Examples
open all close allBasic Examples (2)
Import a 3D model from STL as a MeshRegion object:
Import["ExampleData/seashell.stl"]Summary properties of the solid model:
Import["ExampleData/seashell.stl", "Summary"]Export a 3D model to an ASCII STL file:
Export["model.stl", [image], {"STL", "BinaryFormat" -> False}]Print the raw textual contents of the file:
FilePrint[%]Scope (13)
Import (7)
Import works on an ASCII STL file:
Import["ExampleData/chain.stl"]Import["ExampleData/seashell.stl"]Import["http://exampledata.wolfram.com/vase.stl"]str = OpenRead["ExampleData/spikey.stl"]Import[str]Close[str]Import automatically detects STL files:
Import["http://exampledata.wolfram.com/gear.1"]Import provides access to elements in the STL file:
Import["ExampleData/spikey.stl", "Elements"]Import works on large files:
Import["http://exampledata.wolfram.com/turtle.stl"] // MeshCellCount//AbsoluteTimingExport (6)
Export works on 3D graphics:
Export["model.stl", [image]]Export["sphere.stl", Sphere[]]Export["ball.stl", ImplicitRegion[x ^ 2 + y ^ 2 + z ^ 2 ≤ 1, {x, y, z}]]Export["pyramid.stl", MeshRegion[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}, {0, 0, 1}}, Pyramid[{1, 2, 3, 4, 5}]]]Export["model.stl", [image]]Export["model.stl", [image], "BinaryFormat" -> False]Import Elements (12)
"BinaryFormat" (1)
"BoundaryMeshRegion" (1)
"Comments" (1)
"CoordinateTransform" (1)
"Graphics3D" (1)
Give the Graphics3D object:
Import["ExampleData/spikey.stl", "Graphics3D"]"GraphicsComplex" (1)
Give the GraphicsComplex object:
Import["ExampleData/spikey.stl", "GraphicsComplex"]"MeshRegion" (1)
"PolygonData" (1)
"PolygonObjects" (1)
Give the list of Triangle primitives given in absolute coordinates:
Import["ExampleData/spikey.stl", "PolygonObjects"]"PolygonCount" (1)
"Summary" (1)
Export Options (2)
By default, a binary file is generated when exporting:
Export["model.stl", [image]]Print the raw textual contents of the file:
FilePrint[%]Use "BinaryFormat" False to generate an ASCII file:
Export["model.stl", [image], {"STL", "BinaryFormat" -> False}]Print the raw textual contents of the file:
FilePrint[%]Tech Notes
History
Introduced in 2000 (4.1) | Updated in 2019 (12.0)