serialize-stl

1.0.2 • Public • Published

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);

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i serialize-stl

    Weekly Downloads

    7

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • thibauts