Doodle3D-Slicer/README.md

26 lines
704 B
Markdown
Raw Normal View History

2015-07-26 15:34:57 +02:00
# Doodle3D-Slicer
JavaScript gcode slicer, Intended to use with the Doodle3D WiFi-Box
# Usage
```javascript
2017-07-18 12:38:03 +02:00
import * as THREE from 'three';
2017-07-18 12:43:27 +02:00
import { defaultSettings, Slicer } from 'Doodle3D/Doodle3D-Slicer';
2015-07-26 15:34:57 +02:00
2017-07-18 12:43:27 +02:00
const settings = {
...defaultSettings.base,
...defaultSettings.material.pla,
...defaultSettings.printer.ultimaker2go,
...defaultSettings.quality.high
};
2015-07-26 15:34:57 +02:00
2016-08-19 14:47:15 +02:00
const geometry = new THREE.TorusGeometry(20, 10, 30, 30);
2015-07-26 15:34:57 +02:00
2016-08-19 14:47:15 +02:00
const slicer = new SLICER.Slicer();
2015-07-26 15:37:10 +02:00
slicer.setGeometry(geometry);
2017-07-18 12:43:27 +02:00
const gcode = await slicer.slice(settings)
.progress(({ progress: { done, total, action } }) => {
2017-07-18 12:43:27 +02:00
const percentage = `${(done / total * 100).toFixed()}%`
console.log(action, percentage);
});
2015-07-26 15:34:57 +02:00
```