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
|
|
|
|
2017-07-07 18:11:37 +02:00
|
|
|
const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
|
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)
|
2017-07-19 11:02:14 +02:00
|
|
|
.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
|
|
|
```
|