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