From e675cf200afbcca1bcb2ef04373131708aa6751a Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 18 Jul 2017 12:43:27 +0200 Subject: [PATCH] update readme --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 29498ea..c813056 100644 --- a/README.md +++ b/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, '
'); -}); +const gcode = await slicer.slice(settings) + .progress(({ done, total, action }) => { + const percentage = `${(done / total * 100).toFixed()}%` + console.log(action, percentage); + }); ```