mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
add progress reporting
This commit is contained in:
parent
1f206e5784
commit
dc99f417da
@ -47,6 +47,11 @@ export default class {
|
|||||||
resolve(data.gcode);
|
resolve(data.gcode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'PROGRESS': {
|
||||||
|
if (this.onprogress) {
|
||||||
|
this.onprogress(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -13,32 +13,53 @@ import applyPrecision from './applyPrecision.js';
|
|||||||
import removePrecision from './removePrecision.js';
|
import removePrecision from './removePrecision.js';
|
||||||
|
|
||||||
export default function(geometry, settings) {
|
export default function(geometry, settings) {
|
||||||
geometry.mergeVertices();
|
const totalStages = 15;
|
||||||
geometry.computeFaceNormals();
|
let current = 0;
|
||||||
|
const progressMessage = () => {
|
||||||
|
current++;
|
||||||
|
postMessage({ message: 'PROGRESS', data: { done: current, total: totalStages } });
|
||||||
|
};
|
||||||
|
|
||||||
|
geometry.mergeVertices();
|
||||||
|
progressMessage();
|
||||||
|
geometry.computeFaceNormals();
|
||||||
|
progressMessage();
|
||||||
// get unique lines from geometry;
|
// get unique lines from geometry;
|
||||||
const openClosed = detectOpenClosed(geometry);
|
const openClosed = detectOpenClosed(geometry);
|
||||||
|
progressMessage();
|
||||||
const lines = createLines(geometry, settings, openClosed);
|
const lines = createLines(geometry, settings, openClosed);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layerIntersectionIndexes,
|
layerIntersectionIndexes,
|
||||||
layerIntersectionPoints
|
layerIntersectionPoints
|
||||||
} = calculateLayersIntersections(lines, settings);
|
} = calculateLayersIntersections(lines, settings);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
const shapes = intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings);
|
const shapes = intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
applyPrecision(shapes);
|
applyPrecision(shapes);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
const slices = shapesToSlices(shapes, settings);
|
const slices = shapesToSlices(shapes, settings);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
generateInnerLines(slices, settings);
|
generateInnerLines(slices, settings);
|
||||||
|
progressMessage();
|
||||||
generateInfills(slices, settings);
|
generateInfills(slices, settings);
|
||||||
|
progressMessage();
|
||||||
generateSupport(slices, settings);
|
generateSupport(slices, settings);
|
||||||
|
progressMessage();
|
||||||
addBrim(slices, settings);
|
addBrim(slices, settings);
|
||||||
|
progressMessage();
|
||||||
optimizePaths(slices, settings);
|
optimizePaths(slices, settings);
|
||||||
|
progressMessage();
|
||||||
removePrecision(slices);
|
removePrecision(slices);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
const gcode = slicesToGCode(slices, settings);
|
const gcode = slicesToGCode(slices, settings);
|
||||||
|
progressMessage();
|
||||||
|
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user