update save example

This commit is contained in:
casperlamboo 2017-07-18 10:34:20 +02:00
parent 0f579b8055
commit 94181d6660
3 changed files with 6 additions and 7 deletions

View File

@ -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);
});

View File

@ -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;
}
}
}

View File

@ -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;