Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/serialize-stl-ascii
STL ASCII serialization
https://github.com/thibauts/serialize-stl-ascii
Last synced: 21 days ago
JSON representation
STL ASCII serialization
- Host: GitHub
- URL: https://github.com/thibauts/serialize-stl-ascii
- Owner: thibauts
- License: mit
- Created: 2015-04-08T20:19:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-08T20:36:26.000Z (over 9 years ago)
- Last Synced: 2024-10-16T07:21:27.593Z (2 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
serialize-stl-ascii
===================
### STL ASCII serializationProduces a [STL](http://en.wikipedia.org/wiki/STL_%28file_format%29) (STereoLithography) ASCII string from a mesh. Face normals are computed internally if not provided.
Install
-------```bash
$ npm install serialize-stl-ascii
```Example
-------```javascript
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
*/
```