node-stl
========
[![CircleCI](https://circleci.com/gh/johannesboyne/node-stl.svg?style=svg)](https://circleci.com/gh/johannesboyne/node-stl)
Parse *STL* files with Node.js and get volume, weight, the bounding box, and the center of mass.
## example
```javascript
const NodeStl = require("node-stl");
var stl = NodeStl(__dirname + '/myCool.stl', {density: 1.04});
console.log(stl.volume + 'cm^3'); // 21cm^3
console.log(stl.weight + 'gm'); // 1gm
console.log(stl.boundingBox,'(mm)'); // [60,45,50] (mm)
console.log(stl.area,'(m)'); // 91.26 (m)
console.log(stl.centerOfMass,'(mm)'); // [30,22.5,25] (mm)
```
node-stl recognizes by itself whether it is dealing with an ASCII STL or a binary STL file
## load file from url
Use `request` to load a file from url
```javascript
const NodeStl = require("node-stl");
const request = require('request');
const requestSettings = {
method: 'GET',
url: 'https://s3.amazonaws.com/minifactory-stl/WALLY_1plate.stl',
encoding: null,
};
request(requestSettings, function(error, response, body) {
var stl = new NodeStl(body);
assert.equal(stl.volume, 21.87511539650792);
done(null);
});
```
## install
use [npm/node-stl](https://www.npmjs.com/package/node-stl):
```shell
$ npm install node-stl
```
## license
MIT
## version
`0.7.1`
## contributors
- [alexjv89](https://github.com/alexjv89)
- [redwildfire13](https://github.com/redwildfire13)
- [lexe11](https://github.com/lexe11)
- [Renari](https://github.com/Renari)
- [jacekkopecky](https://github.com/jacekkopecky)
- [grmmph](https://github.com/grmmph)
没有合适的资源?快使用搜索试试~ 我知道了~
node-stl:使用Node.js解析stl文件并获取体积和重量
共16个文件
stl:7个
js:3个
json:2个
需积分: 40 5 下载量 147 浏览量
2021-05-27
19:04:21
上传
评论 1
收藏 5.91MB ZIP 举报
温馨提示
节点 使用Node.js解析STL文件,并获取体积,重量,边界框和质心。 例子 const NodeStl = require ( "node-stl" ) ; var stl = NodeStl ( __dirname + '/myCool.stl' , { density : 1.04 } ) ; console . log ( stl . volume + 'cm^3' ) ; // 21cm^3 console . log ( stl . weight + 'gm' ) ; // 1gm console . log ( stl . boundingBox , '(mm)' ) ; // [60,45,50] (mm) console . log ( stl . area , '(m)' ) ; // 91.26 (m) console
资源详情
资源评论
资源推荐
收起资源包目录
node-stl-master.zip (16个子文件)
node-stl-master
.gitignore 111B
package.json 1KB
package-lock.json 46KB
LICENSE 1KB
index.js 8KB
README.md 2KB
lib
vector3.js 2KB
.circleci
config.yml 978B
test
test_data
RasPiCaseLight.stl 12KB
002.STL 2KB
box.stl 95KB
WALLY_1plate.stl 70KB
Pterosaur_FDM.stl 9.6MB
box_3x3x3_offset.stl 2KB
box_2x3x4.stl 1KB
parse.js 3KB
共 16 条
- 1
新文达·小文姐姐
- 粉丝: 29
- 资源: 4545
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0