Added simple example

This commit is contained in:
peteruithoven 2017-07-07 18:10:29 +02:00
parent b517ad222b
commit 94c21360b2
4 changed files with 35 additions and 3 deletions

View File

@ -174,7 +174,7 @@ SystemJS.config({
"module": "npm:jspm-nodelibs-module@0.2.0", "module": "npm:jspm-nodelibs-module@0.2.0",
"os": "npm:jspm-nodelibs-os@0.2.0", "os": "npm:jspm-nodelibs-os@0.2.0",
"path": "npm:jspm-nodelibs-path@0.2.0", "path": "npm:jspm-nodelibs-path@0.2.0",
"process": "npm:jspm-nodelibs-process@0.2.0", "process": "github:jspm/nodelibs-process@0.2.0-alpha",
"stream": "npm:jspm-nodelibs-stream@0.2.0", "stream": "npm:jspm-nodelibs-stream@0.2.0",
"string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.0", "string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.0",
"tty": "npm:jspm-nodelibs-tty@0.2.0", "tty": "npm:jspm-nodelibs-tty@0.2.0",
@ -419,7 +419,8 @@ SystemJS.config({
}, },
"github:Doodle3D/clipper-js@1.0.2": { "github:Doodle3D/clipper-js@1.0.2": {
"map": { "map": {
"Breush/clipper-lib": "github:Breush/clipper-lib@patch-1" "Breush/clipper-lib": "github:Breush/clipper-lib@patch-1",
"clipper-lib": "npm:clipper-lib@6.2.1"
} }
} }
} }

View File

@ -38,7 +38,7 @@
"module": "npm:jspm-nodelibs-module@^0.2.0", "module": "npm:jspm-nodelibs-module@^0.2.0",
"os": "npm:jspm-nodelibs-os@^0.2.0", "os": "npm:jspm-nodelibs-os@^0.2.0",
"path": "npm:jspm-nodelibs-path@^0.2.0", "path": "npm:jspm-nodelibs-path@^0.2.0",
"process": "npm:jspm-nodelibs-process@^0.2.0", "process": "github:jspm/nodelibs-process@^0.2.0-alpha",
"stream": "npm:jspm-nodelibs-stream@^0.2.0", "stream": "npm:jspm-nodelibs-stream@^0.2.0",
"string_decoder": "npm:jspm-nodelibs-string_decoder@^0.2.0", "string_decoder": "npm:jspm-nodelibs-string_decoder@^0.2.0",
"tty": "npm:jspm-nodelibs-tty@^0.2.0", "tty": "npm:jspm-nodelibs-tty@^0.2.0",

15
simpleExample/index.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE>
<html>
<head>
<title>Doodle3D Slicer - Simple example</title>
<script type="text/javascript" src="../jspm_packages/system.js"></script>
<script type="text/javascript" src="../jspm.config.js"></script>
<script type="text/javascript">
System.import('simpleExample/index.js');
</script>
</head>
<body>
<div id="gcode"></div>
</body>
</html>

16
simpleExample/index.js Normal file
View File

@ -0,0 +1,16 @@
import 'three.js';
import * as SLICER from 'src/index.js';
const settings = new SLICER.Settings({
...SLICER.printerSettings['ultimaker2go'],
...SLICER.userSettings.low
});
const geometry = new THREE.TorusGeometry(20, 10, 30, 30).clone();
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, '<br />');
});