Doodle3D-Slicer/example/app.js

18 lines
475 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-03-29 00:35:53 +02:00
slicer.addEventListener('finish', ({ gcode }) => {
document.getElementById('gcode').innerHTML = gcode.replace(/(?:\r\n|\r|\n)/g, '<br />');
});
2015-10-14 17:11:29 +02:00
slicer.slice(settings);