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