update readme

This commit is contained in:
casperlamboo 2017-07-18 12:43:27 +02:00
parent 1d2a9ba965
commit e675cf200a

View File

@ -4,19 +4,22 @@ JavaScript gcode slicer, Intended to use with the Doodle3D WiFi-Box
```javascript
import * as THREE from 'three';
import * as SLICER from 'doodle3d-slicer';
import { defaultSettings, Slicer } from 'Doodle3D/Doodle3D-Slicer';
const settings = new SLICER.Settings({
...SLICER.printerSettings['ultimaker2go'],
...SLICER.userSettings
});
const settings = {
...defaultSettings.base,
...defaultSettings.material.pla,
...defaultSettings.printer.ultimaker2go,
...defaultSettings.quality.high
};
const geometry = new THREE.TorusGeometry(20, 10, 30, 30);
const slicer = new SLICER.Slicer();
slicer.setGeometry(geometry);
slicer.slice(settings, false).then(gcode => {
document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
});
const gcode = await slicer.slice(settings)
.progress(({ done, total, action }) => {
const percentage = `${(done / total * 100).toFixed()}%`
console.log(action, percentage);
});
```