JSPM

parse-stl-ascii

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33
  • Score
    100M100P100Q60950F
  • License MIT

STL ASCII parser

Package Exports

  • parse-stl-ascii

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-stl-ascii) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parse-stl-ascii

STL ASCII parser

Parses an STL (STereoLithography) ASCII string or buffer to a mesh compatible with simplicial-complex*. If you're looking for a streaming parser check this.

This module works well with merge-vertices to deduplicate identical vertices from different faces.

* Files having faces with more than 3 vertices will have to be triangulated for use with simplicial-complex. One option is using earcut.

Install

$ npm install parse-stl-ascii

Usage

var parseSTL = require('parse-stl-ascii');
var fs = require('fs');

var buf = fs.readFileSync('mesh.stl');
var mesh = parseSTL(buf);

console.log(mesh);
/*
{
  positions: [...],
  cells: [...],
  faceNormals: [...],
  name: 'solid name'
}
*/