mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
update save example
This commit is contained in:
parent
0f579b8055
commit
94181d6660
@ -10,13 +10,12 @@ const settings = new Settings({
|
|||||||
const jsonLoader = new THREE.JSONLoader();
|
const jsonLoader = new THREE.JSONLoader();
|
||||||
jsonLoader.load('models/airplane.json', async geometry => {
|
jsonLoader.load('models/airplane.json', async geometry => {
|
||||||
geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI / -2));
|
geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI / -2));
|
||||||
geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(50, -0.1, 50)));
|
geometry.applyMatrix(new THREE.Matrix4().setPosition(new THREE.Vector3(50, 0.1, 50)));
|
||||||
geometry.mergeVertices();
|
|
||||||
geometry.computeFaceNormals();
|
geometry.computeFaceNormals();
|
||||||
|
|
||||||
const slicer = new Slicer().setGeometry(geometry);
|
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);
|
saveAs(file);
|
||||||
});
|
});
|
||||||
|
@ -7,12 +7,12 @@ export default function detectOpenClosed(lines) {
|
|||||||
for (let i = 0; i < pools.length; i ++) {
|
for (let i = 0; i < pools.length; i ++) {
|
||||||
const pool = pools[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 ++) {
|
for (let j = 0; j < pool.length; j ++) {
|
||||||
const lineIndex = pool[j];
|
const lineIndex = pool[j];
|
||||||
const line = lines[lineIndex];
|
const line = lines[lineIndex];
|
||||||
line.open = isOpen;
|
line.openGeometry = isOpenGeometry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export default function intersectionsToShapes(layerIntersectionIndexes, layerInt
|
|||||||
const shape = [];
|
const shape = [];
|
||||||
|
|
||||||
const firstPoints = [index];
|
const firstPoints = [index];
|
||||||
const { open: openGeometry } = lines[index];
|
const { openGeometry } = lines[index];
|
||||||
let isFirstPoint = true;
|
let isFirstPoint = true;
|
||||||
let openShape = true;
|
let openShape = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user