Reference saveStl()

saveStl()

The saveStl() function exports p5.Geometry objects as 3D models in the STL stereolithography file format. This way, you can use the 3D shapes you create in p5.js in other software for rendering, animation, 3D printing, or more.

The exported .stl file will include the faces, vertices, and normals of the p5.Geometry.

By default, this method saves a text-based .stl file. Alternatively, you can save a more compact but less human-readable binary .stl file by passing { binary: true } as a second parameter.

Examples

Syntax

saveStl([fileName], [options])

Parameters

fileName
String:

The name of the file to save the model as. If not specified, the default file name will be 'model.stl'.

options
Object:

Optional settings. Options can include a boolean binary property, which controls whether or not a binary .stl file is saved. It defaults to false.

Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/p5.Geometry.js and open a pull request!

Related References