diff --git a/example/save.js b/example/save.js index 0003df2..3339d17 100644 --- a/example/save.js +++ b/example/save.js @@ -10,13 +10,12 @@ const settings = new Settings({ const jsonLoader = new THREE.JSONLoader(); jsonLoader.load('models/airplane.json', async geometry => { geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI / -2)); - geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(50, -0.1, 50))); - geometry.mergeVertices(); + geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(50, 0.1, 50))); geometry.computeFaceNormals(); const slicer = new Slicer().setGeometry(geometry); - const gcode = await slicer.slice(settings); + const gcode = slicer.sliceSync(settings); - const file = new File([gcode], 'traktor.gcode', { type: 'text/plain' }); + const file = new File([gcode], 'gcode.gcode', { type: 'text/plain' }); saveAs(file); }); diff --git a/src/sliceActions/detectOpenClosed.js b/src/sliceActions/detectOpenClosed.js index 228280e..443e103 100644 --- a/src/sliceActions/detectOpenClosed.js +++ b/src/sliceActions/detectOpenClosed.js @@ -7,12 +7,12 @@ export default function detectOpenClosed(lines) { for (let i = 0; i < pools.length; i ++) { const pool = pools[i]; - const isOpen = pool.some(lineIndex => openLines[lineIndex]); + const isOpenGeometry = pool.some(lineIndex => openLines[lineIndex]); for (let j = 0; j < pool.length; j ++) { const lineIndex = pool[j]; const line = lines[lineIndex]; - line.open = isOpen; + line.openGeometry = isOpenGeometry; } } } diff --git a/src/sliceActions/intersectionsToShapes.js b/src/sliceActions/intersectionsToShapes.js index 52db98b..fbd4903 100644 --- a/src/sliceActions/intersectionsToShapes.js +++ b/src/sliceActions/intersectionsToShapes.js @@ -22,7 +22,7 @@ export default function intersectionsToShapes(layerIntersectionIndexes, layerInt const shape = []; const firstPoints = [index]; - const { open: openGeometry } = lines[index]; + const { openGeometry } = lines[index]; let isFirstPoint = true; let openShape = true;