Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/serialize-stl
STL (ASCII and binary) file serialization
https://github.com/thibauts/serialize-stl
Last synced: 2 months ago
JSON representation
STL (ASCII and binary) file serialization
- Host: GitHub
- URL: https://github.com/thibauts/serialize-stl
- Owner: thibauts
- License: mit
- Created: 2015-04-08T20:54:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-08T21:01:42.000Z (over 9 years ago)
- Last Synced: 2024-10-08T09:44:52.548Z (3 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
serialize-stl
=============
### STL (ASCII and binary) file serializationProduces a [STL](http://en.wikipedia.org/wiki/STL_%28file_format%29) (STereoLithography) ASCII string or binary buffer from a mesh. Face normals are computed internally if not provided.
Install
-------```bash
$ npm install serialize-stl
```Usage
-----```javascript
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 internallyvar buf = serializeSTL(mesh.cells, mesh.positions/*, faceNormals, ascii*/);
fs.writeFileSync('mesh.stl', buf);
```