Doodle3D-Slicer/README.md

23 lines
568 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
import THREE from 'three.js';
2016-08-19 14:47:15 +02:00
import * as SLICER from 'doodle3d-slicer';
2015-07-26 15:34:57 +02:00
2016-08-19 14:47:15 +02:00
const settings = new SLICER.Settings({
2017-05-13 14:48:48 +02:00
...SLICER.printerSettings['ultimaker2go'],
...SLICER.userSettings
2016-08-19 14:47:15 +02:00
});
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:34:57 +02:00
2015-07-26 15:37:10 +02:00
slicer.setGeometry(geometry);
2016-08-19 14:47:15 +02:00
slicer.slice(settings, false).then(gcode => {
2017-05-13 14:48:48 +02:00
document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
2016-08-19 14:47:15 +02:00
});
2015-07-26 15:34:57 +02:00
```