Doodle3D-Slicer/example/app.js

17 lines
439 B
JavaScript
Raw Normal View History

2015-07-26 15:32:10 +02:00
import THREE from 'three.js';
import * as SLICER from 'src/index';
2016-07-19 14:23:23 +02:00
const settings = new SLICER.Settings({
...SLICER.printerSettings['ultimaker2go'],
...SLICER.userSettings
});
2015-07-26 15:32:10 +02:00
2016-05-08 11:12:35 +02:00
const geometry = new THREE.TorusGeometry(20, 10, 30, 30);
2015-07-26 15:32:10 +02:00
2016-05-08 11:12:35 +02:00
const slicer = new SLICER.Slicer();
2015-07-26 15:32:10 +02:00
2016-05-09 11:42:23 +02:00
slicer.setGeometry(geometry);
2016-08-19 15:12:20 +02:00
slicer.slice(settings).then(gcode => {
2016-03-29 00:35:53 +02:00
document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
});