serialize-stl
v1.0.2
Published
STL (ASCII and binary) file serialization
Downloads
19
Readme
serialize-stl
STL (ASCII and binary) file serialization
Produces a STL (STereoLithography) ASCII string or binary buffer from a mesh. Face normals are computed internally if not provided.
Install
$ npm install serialize-stl
Usage
var serializeSTL = require('serialize-stl');
var fs = require('fs');
var mesh = {
positions: [
[-1.0, 0.0, 0.0],
[ 0.0, 1.0, 0.0],
[ 1.0, 0.0, 0.0]
],
cells: [
[0, 1, 2]
]
};
// if ascii === true, will output an ASCII STL file.
// if faceNormals is falsy normals will be computed internally
var buf = serializeSTL(mesh.cells, mesh.positions/*, faceNormals, ascii*/);
fs.writeFileSync('mesh.stl', buf);