2015-07-26 15:32:10 +02:00
|
|
|
import THREE from 'three.js';
|
|
|
|
import PRINTER_SETTINGS from 'settings/printer_settings.json!';
|
|
|
|
import USER_SETTINGS from 'settings/user_settings.json!';
|
|
|
|
import * as SLICER from 'src/index';
|
|
|
|
|
2015-10-14 17:11:29 +02:00
|
|
|
var settings = new SLICER.Settings();
|
|
|
|
settings.updateConfig(PRINTER_SETTINGS["ultimaker2go"]);
|
|
|
|
settings.updateConfig(USER_SETTINGS);
|
2015-07-26 15:32:10 +02:00
|
|
|
|
2015-10-14 17:11:29 +02:00
|
|
|
var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
2015-07-26 15:32:10 +02:00
|
|
|
|
2015-10-14 17:11:29 +02:00
|
|
|
var slicer = new SLICER.Slicer();
|
|
|
|
//var slicer = new SLICER.SlicerWorker();
|
2015-07-26 15:32:10 +02:00
|
|
|
|
2015-10-14 17:11:29 +02:00
|
|
|
slicer.setGeometry(geometry.clone());
|
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);
|