mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
cleanup
This commit is contained in:
parent
701d736cc0
commit
6be1291923
@ -38,7 +38,7 @@ export default class GCode {
|
|||||||
turnFanOn(fanSpeed) {
|
turnFanOn(fanSpeed) {
|
||||||
this._isFanOn = true;
|
this._isFanOn = true;
|
||||||
|
|
||||||
const gcode = { [M_COMMAND]: 106 }
|
const gcode = { [M_COMMAND]: 106 };
|
||||||
if (typeof fanSpeed !== 'undefined') gcode[FAN_SPEED] = fanSpeed;
|
if (typeof fanSpeed !== 'undefined') gcode[FAN_SPEED] = fanSpeed;
|
||||||
|
|
||||||
this._addGCode(gcode);
|
this._addGCode(gcode);
|
||||||
|
@ -14,19 +14,11 @@ import { hslToRgb } from './helpers/color.js';
|
|||||||
// // import removePrecision from './removePrecision.js';
|
// // import removePrecision from './removePrecision.js';
|
||||||
|
|
||||||
export default function(settings, geometry, openObjectIndexes, constructLinePreview, onProgress) {
|
export default function(settings, geometry, openObjectIndexes, constructLinePreview, onProgress) {
|
||||||
const totalStages = 11;
|
const total = 11;
|
||||||
let current = -1;
|
let done = -1;
|
||||||
const updateProgress = (action) => {
|
const updateProgress = action => {
|
||||||
current ++;
|
done ++;
|
||||||
if (typeof onProgress !== 'undefined') {
|
if (onProgress) onProgress({ progress: { done, total, action } });
|
||||||
onProgress({
|
|
||||||
progress: {
|
|
||||||
done: current,
|
|
||||||
total: totalStages,
|
|
||||||
action
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateProgress('Constructing unique lines from geometry');
|
updateProgress('Constructing unique lines from geometry');
|
||||||
@ -70,9 +62,9 @@ export default function(settings, geometry, openObjectIndexes, constructLinePrev
|
|||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRECISION_INVERSE = 1000;
|
const PRECISION = 1000;
|
||||||
function toFixedTrimmed(value) {
|
function toFixedTrimmed(value) {
|
||||||
return (Math.round(value * PRECISION_INVERSE) / PRECISION_INVERSE).toString();
|
return (Math.round(value * PRECISION) / PRECISION).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function gcodeToString(gcode) {
|
function gcodeToString(gcode) {
|
||||||
|
@ -96,9 +96,7 @@ function sliceAsync(settings, geometry, openObjectIndexes, constructLinePreview,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'PROGRESS': {
|
case 'PROGRESS': {
|
||||||
if (typeof onProgress !== 'undefined') {
|
if (typeof onProgress !== 'undefined') onProgress(data);
|
||||||
onProgress(data);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user