STL - Maple Help

STL (.stl) File Format

STL: Stereolithography file

Description

 • STL (Stereolithography) is a file format for computer-aided design and modeling.
 • It represents geometric data as a set of 3-D triangles and surface normals. The standard STL format does not support face colors or textures.
 • This format has both text-based and binary variants.
 • The plottools[importplot] and plottools[exportplot] commands can be used for data exchange between this format and Maple 3-D plots. Both the text-based and binary variants are fully supported.
 • The general-purpose commands Import and Export also support this format. By default, the Import command returns a plot. With the option output=triangles, Import returns a DataFrame with the coordinate data for all triangles in the source file.

Details

 • When exporting a 3-D plot to STL, note that because of the limitations of the format, only GRID, MESH, and POLYGONS plot structures will be exported. All other plot data (for example CURVES or POINTS structures) will be ignored for the purposes of exporting.
 • With both the plottools[exportplot] and Export commands, you can specify whether the text-based or binary format should be used by including encoding=text or encoding=binary, respectively.

Notes

 • Content-Type: application/sla

Examples

Import a geometric object from an STL file as a 3-D plot

 > $\mathrm{Import}\left("example/dodecahedron.stl",\mathrm{base}=\mathrm{datadir}\right)$

Import only the point data from this geometric object.

 > $\mathrm{Import}\left("example/dodecahedron.stl",\mathrm{base}=\mathrm{datadir},\mathrm{output}=\mathrm{triangles}\right)$
 $\begin{array}{c}\left[\begin{array}{cccccccccc}{}& {\mathrm{x1}}& {\mathrm{y1}}& {\mathrm{z1}}& {\mathrm{x2}}& {\mathrm{y2}}& {\mathrm{z2}}& {\mathrm{x3}}& {\mathrm{y3}}& {\mathrm{z3}}\\ {1}& {2.70348286628723}& {1.34053897857666}& {1.78540062904358}& {2.02487659454346}& {1.}& {1.70102679729462}& {1.60935950279236}& {1.41871273517609}& {1.21562242507935}\\ {2}& {2.70348286628723}& {1.34053897857666}& {1.78540062904358}& {1.60935950279236}& {1.41871273517609}& {1.21562242507935}& {2.03116202354431}& {2.01803040504456}& {1.}\\ {3}& {2.70348286628723}& {1.34053897857666}& {1.78540062904358}& {2.03116202354431}& {2.01803040504456}& {1.}& {2.70736742019653}& {1.96971642971039}& {1.35214233398438}\\ {4}& {1.04519772529602}& {2.44494843482971}& {1.61112964153290}& {1.68249082565308}& {2.65227890014648}& {1.24443686008453}& {2.03116202354431}& {2.01803040504456}& {1.}\\ {5}& {1.04519772529602}& {2.44494843482971}& {1.61112964153290}& {2.03116202354431}& {2.01803040504456}& {1.}& {1.60935950279236}& {1.41871273517609}& {1.21562242507935}\\ {6}& {1.04519772529602}& {2.44494843482971}& {1.61112964153290}& {1.60935950279236}& {1.41871273517609}& {1.21562242507935}& {1.}& {1.68256258964539}& {1.59332132339478}\\ {7}& {2.14320564270020}& {2.99595212936401}& {1.74764943122864}& {2.77661418914795}& {2.57410526275635}& {1.81421506404877}& {2.70736742019653}& {1.96971642971039}& {1.35214233398438}\\ {8}& {2.14320564270020}& {2.99595212936401}& {1.74764943122864}& {2.70736742019653}& {1.96971642971039}& {1.35214233398438}& {2.03116202354431}& {2.01803040504456}& {1.}\\ {9}& {2.14320564270020}& {2.99595212936401}& {1.74764943122864}& {2.03116202354431}& {2.01803040504456}& {1.}& {1.68249082565308}& {2.65227890014648}& {1.24443686008453}\\ {10}& {2.81552648544312}& {2.31846046447754}& {2.53305006027222}& {2.77032876014709}& {1.55607473850250}& {2.51524186134338}& {2.70348286628723}& {1.34053897857666}& {1.78540062904358}\\ {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{36 x 9 DataFrame}}\end{array}$ (1)

Export a 3-D plot to a binary STL file in the home directory of the current user.

 > $\mathrm{knot}≔\mathrm{algcurves}\left[\mathrm{plot_knot}\right]\left(\left(-{x}^{7}+{y}^{3}\right)\left(-2{x}^{5}+{y}^{2}\right),x,y,\mathrm{\epsilon }=0.8,\mathrm{radius}=0.1,\mathrm{tubepoints}=9\right):$
 > $\mathrm{Export}\left("knot.stl",\mathrm{knot},\mathrm{base}=\mathrm{homedir}\right)$
 ${238484}$ (2)

Do the same as the previous step, but produce a text-based STL file.

 > $\mathrm{Export}\left("knot-text.stl",\mathrm{knot},\mathrm{base}=\mathrm{homedir},\mathrm{encoding}=\mathrm{text}\right)$
 ${1296957}$ (3)