2017-11-11 20:23:45 +01:00
|
|
|
import React from 'react';
|
2017-07-20 12:12:25 +02:00
|
|
|
import * as THREE from 'three';
|
2017-11-11 20:23:45 +01:00
|
|
|
import { Interface } from 'doodle3d-slicer';
|
2017-11-12 00:11:05 +01:00
|
|
|
import fileURL from '!url-loader!./models/shape.json';
|
2017-11-11 20:23:45 +01:00
|
|
|
import { render } from 'react-dom';
|
2017-11-12 01:15:38 +01:00
|
|
|
import fileSaver from 'file-saver';
|
|
|
|
|
|
|
|
const downloadGCode = gcode => {
|
|
|
|
const file = new File([gcode], 'gcode.gcode', { type: 'text/plain' });
|
|
|
|
fileSaver.saveAs(file);
|
|
|
|
};
|
2017-07-07 18:10:29 +02:00
|
|
|
|
2017-08-17 16:13:30 +02:00
|
|
|
const jsonLoader = new THREE.JSONLoader();
|
|
|
|
jsonLoader.load(fileURL, geometry => {
|
2017-11-12 01:15:38 +01:00
|
|
|
render(<Interface
|
|
|
|
geometry={geometry}
|
|
|
|
onCompleteActions={[{ title: 'Download', callback: downloadGCode }]}
|
|
|
|
/>, document.getElementById('app'));
|
2017-07-28 10:48:46 +02:00
|
|
|
});
|