1.0.1 • Published 9 years ago
serialize-stl-ascii v1.0.1
serialize-stl-ascii
STL ASCII serialization
Produces a STL (STereoLithography) ASCII string from a mesh. Face normals are computed internally if not provided.
Install
$ npm install serialize-stl-ascii
Example
var serializeSTL = require('serialize-stl-ascii');
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]
]
}
var str = serializeSTL(mesh.cells, mesh.positions/*, faceNormals, solidName*/);
console.log(str);
/*
solid
facet normal 0e+0 0e+0 -1e+0
outer loop
vertex -1e+0 0e+0 0e+0
vertex 0e+0 1e+0 0e+0
vertex 1e+0 0e+0 0e+0
endloop
endfacet
endsolid
*/