mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
remove update progress code
want to implement this in a different way
This commit is contained in:
parent
604bce6a1a
commit
16847c624f
@ -16,18 +16,6 @@ import removePrecision from './sliceActions/removePrecision.js';
|
|||||||
export default class extends EventDispatcher {
|
export default class extends EventDispatcher {
|
||||||
constructor () {
|
constructor () {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.progress = {
|
|
||||||
createdLines: false,
|
|
||||||
calculatedLayerIntersections: false,
|
|
||||||
sliced: false,
|
|
||||||
generatedSlices: false,
|
|
||||||
generatedInnerLines: false,
|
|
||||||
generatedInfills: false,
|
|
||||||
generatedSupport: false,
|
|
||||||
optimizedPaths: false,
|
|
||||||
generatedGCode: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setMesh (mesh) {
|
setMesh (mesh) {
|
||||||
@ -65,74 +53,33 @@ export default class extends EventDispatcher {
|
|||||||
slice (settings) {
|
slice (settings) {
|
||||||
// get unique lines from geometry;
|
// get unique lines from geometry;
|
||||||
const lines = createLines(this.geometry, settings);
|
const lines = createLines(this.geometry, settings);
|
||||||
this.progress.createdLines = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
layerIntersectionIndexes,
|
layerIntersectionIndexes,
|
||||||
layerIntersectionPoints
|
layerIntersectionPoints
|
||||||
} = calculateLayersIntersections(lines, settings);
|
} = calculateLayersIntersections(lines, settings);
|
||||||
this.progress.calculatedLayerIntersections = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
const shapes = intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings);
|
const shapes = intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings);
|
||||||
this.progress.sliced = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
applyPrecision(shapes);
|
applyPrecision(shapes);
|
||||||
|
|
||||||
const slices = shapesToSlices(shapes, settings);
|
const slices = shapesToSlices(shapes, settings);
|
||||||
this.progress.generatedSlices = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
generateInnerLines(slices, settings);
|
generateInnerLines(slices, settings);
|
||||||
this.progress.generatedInnerLines = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
generateInfills(slices, settings);
|
generateInfills(slices, settings);
|
||||||
this.progress.generatedInfills = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
generateSupport(slices, settings);
|
generateSupport(slices, settings);
|
||||||
this.progress.generatedSupport = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
addBrim(slices, settings);
|
addBrim(slices, settings);
|
||||||
|
|
||||||
optimizePaths(slices, settings);
|
optimizePaths(slices, settings);
|
||||||
this.progress.optimizedPaths = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
removePrecision(slices);
|
removePrecision(slices);
|
||||||
|
|
||||||
var gcode = slicesToGCode(slices, settings);
|
const gcode = slicesToGCode(slices, settings);
|
||||||
this.progress.generatedGCode = true;
|
|
||||||
this._updateProgress(settings);
|
|
||||||
|
|
||||||
this.dispatchEvent({ type: 'finish', gcode });
|
this.dispatchEvent({ type: 'finish', gcode });
|
||||||
|
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateProgress (settings) {
|
|
||||||
var supportEnabled = settings.config['supportEnabled'];
|
|
||||||
|
|
||||||
var progress = {};
|
|
||||||
|
|
||||||
var procent = 0;
|
|
||||||
var length = 0;
|
|
||||||
for (var i in this.progress) {
|
|
||||||
if (!(!supportEnabled && i === 'generatedSupport')) {
|
|
||||||
progress[i] = this.progress[i];
|
|
||||||
if (progress[i]) {
|
|
||||||
procent += 1;
|
|
||||||
}
|
|
||||||
length += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
progress.procent = procent / length;
|
|
||||||
|
|
||||||
this.dispatchEvent({ type: 'progress', progress });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user