mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
update readme
This commit is contained in:
parent
1d2a9ba965
commit
e675cf200a
21
README.md
21
README.md
@ -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);
|
||||
});
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user