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