Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thibauts/parse-stl
STL (ASCII and binary) file parser
https://github.com/thibauts/parse-stl
Last synced: 2 months ago
JSON representation
STL (ASCII and binary) file parser
- Host: GitHub
- URL: https://github.com/thibauts/parse-stl
- Owner: thibauts
- License: mit
- Created: 2015-04-07T21:05:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-07T21:33:24.000Z (over 9 years ago)
- Last Synced: 2024-08-09T20:10:25.895Z (5 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
parse-stl
=========
### STL (ASCII and binary) file parserParses an [STL](http://en.wikipedia.org/wiki/STL_%28file_format%29) (STereoLithography) ASCII or binary buffer to a mesh compatible with [simplicial-complex*](https://github.com/mikolalysenko/simplicial-complex). If you're looking for a streaming parser check [this](https://github.com/tmpvar/stl).
This module works well with [merge-vertices](https://github.com/thibauts/merge-vertices) to deduplicate identical vertices from different faces.
\* ASCII files having faces with more than 3 vertices will have to be triangulated for use with [simplicial-complex](https://github.com/mikolalysenko/simplicial-complex). One option is using [earcut](https://github.com/mapbox/earcut).
Install
-------```bash
$ npm install parse-stl
```Usage
-----```javascript
var parseSTL = require('parse-stl');
var fs = require('fs');var buf = fs.readFileSync('mesh.stl');
var mesh = parseSTL(buf);console.log(mesh);
/*
{
positions: [...],
cells: [...],
faceNormals: [...]
}
*/
```