mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-16 11:07:57 +01:00
Fix progress bug
This commit is contained in:
parent
151dee5ee9
commit
7064058464
3919
library/benchmark.js
3919
library/benchmark.js
File diff suppressed because it is too large
Load Diff
4463
library/cal.js
4463
library/cal.js
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
"shellThickness": 0.4,
|
||||
"brimOffset": 4.0,
|
||||
"fillGridSize": 5.0,
|
||||
"infillOverlap": 0.5,
|
||||
"infillOverlap": 0.0,
|
||||
"travelSpeed": 200.0,
|
||||
"retractionAmount": 3.0,
|
||||
"retractionEnabled": true,
|
||||
@ -13,32 +13,32 @@
|
||||
"retractionMinDistance": 0.0,
|
||||
"supportAcceptanceMargin": 1.5,
|
||||
"supportDistanceY": 0.4,
|
||||
"supportUse": true,
|
||||
"supportUse": false,
|
||||
"supportGridSize": 6.0,
|
||||
"supportMargin": 2.0,
|
||||
"supportPlateSize": 4.0,
|
||||
"outerLine": {
|
||||
"flowRate": 1.0,
|
||||
"speed": 50.0
|
||||
"speed": 40.0
|
||||
},
|
||||
"innerLine": {
|
||||
"flowRate": 1.0,
|
||||
"speed": 80.0
|
||||
"speed": 50.0
|
||||
},
|
||||
"fill": {
|
||||
"flowRate": 1.0,
|
||||
"speed": 80.0
|
||||
"speed": 50.0
|
||||
},
|
||||
"brim": {
|
||||
"flowRate": 1.0,
|
||||
"speed": 50.0
|
||||
"speed": 40.0
|
||||
},
|
||||
"support": {
|
||||
"flowRate": 0.8,
|
||||
"speed": 100.0
|
||||
"speed": 40.0
|
||||
},
|
||||
"bottom": {
|
||||
"flowRate": 2.0,
|
||||
"speed": 30.0
|
||||
"flowRate": 1.2,
|
||||
"speed": 40.0
|
||||
}
|
||||
}
|
@ -241,7 +241,7 @@ D3D.Paths.prototype.draw = function (context, color) {
|
||||
for (var j = 0; j < shape.length; j ++) {
|
||||
var point = shape[j % shape.length];
|
||||
|
||||
context.lineTo(point.X*2, point.Y*2);
|
||||
context.lineTo(point.X * 2, point.Y * 2);
|
||||
}
|
||||
if (this.closed) {
|
||||
context.closePath();
|
||||
|
@ -42,9 +42,6 @@ D3D.Slicer.prototype.setMesh = function (geometry, matrix) {
|
||||
|
||||
this.geometry = geometry;
|
||||
|
||||
//get unique lines from geometry;
|
||||
this._createLines();
|
||||
|
||||
return this;
|
||||
};
|
||||
D3D.Slicer.prototype.getGCode = function (printer) {
|
||||
@ -54,12 +51,10 @@ D3D.Slicer.prototype.getGCode = function (printer) {
|
||||
var dimensionsZ = printer.config["dimensionsZ"];
|
||||
var useSupport = printer.config["supportUse"];
|
||||
|
||||
this.progress.totalLayers = Math.floor(Math.min(this.geometry.boundingBox.max.y, dimensionsZ) / layerHeight);
|
||||
this.progress.sliceLayer = 0;
|
||||
this.progress.dataLayer = 0;
|
||||
this.progress.gcodeLayer = 0;
|
||||
//get unique lines from geometry;
|
||||
this._createLines(printer);
|
||||
|
||||
var slices = this._slice(layerHeight, dimensionsZ);
|
||||
var slices = this._slice(printer);
|
||||
|
||||
this._generateInnerLines(slices, printer);
|
||||
|
||||
@ -78,17 +73,22 @@ D3D.Slicer.prototype.getGCode = function (printer) {
|
||||
D3D.Slicer.prototype._updateProgress = function () {
|
||||
'use strict';
|
||||
|
||||
var useSupport = printer.config["supportUse"];
|
||||
|
||||
var progress = {};
|
||||
|
||||
var procent = 0;
|
||||
var length = 0;
|
||||
for (var i in this.progress) {
|
||||
progress[i] = this.progress[i];
|
||||
procent += this.progress[i] ? 1 : 0;
|
||||
length ++;
|
||||
if (!(!useSupport && i === "generatedSupport")) {
|
||||
progress[i] = this.progress[i];
|
||||
if (this.progress[i]) {
|
||||
procent ++;
|
||||
}
|
||||
length ++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(procent, length);
|
||||
progress.procent = procent / length;
|
||||
|
||||
if (this.onProgress !== undefined) {
|
||||
@ -96,7 +96,7 @@ D3D.Slicer.prototype._updateProgress = function () {
|
||||
this.onProgress(progress);
|
||||
}
|
||||
};
|
||||
D3D.Slicer.prototype._createLines = function () {
|
||||
D3D.Slicer.prototype._createLines = function (printer) {
|
||||
"use strict";
|
||||
|
||||
this._lines = [];
|
||||
@ -144,12 +144,15 @@ D3D.Slicer.prototype._createLines = function () {
|
||||
}
|
||||
|
||||
this.progress.createdLines = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
};
|
||||
D3D.Slicer.prototype._slice = function (layerHeight, height) {
|
||||
D3D.Slicer.prototype._slice = function (printer) {
|
||||
"use strict";
|
||||
|
||||
var testData = [];
|
||||
var layerHeight = printer.config["layerHeight"];
|
||||
var height = printer.config["dimensionsZ"];
|
||||
|
||||
//var testData = [];
|
||||
|
||||
var numLayers = height / layerHeight;
|
||||
|
||||
@ -172,7 +175,7 @@ D3D.Slicer.prototype._slice = function (layerHeight, height) {
|
||||
}
|
||||
|
||||
var slices = [];
|
||||
var testPoints = [];
|
||||
//var testPoints = [];
|
||||
|
||||
for (var layer = 1; layer < layersIntersections.length; layer ++) {
|
||||
var layerIntersections = layersIntersections[layer];
|
||||
@ -197,13 +200,13 @@ D3D.Slicer.prototype._slice = function (layerHeight, height) {
|
||||
}
|
||||
intersections[index] = new THREE.Vector2(z, x);
|
||||
|
||||
testPoints.push({
|
||||
/*testPoints.push({
|
||||
x: z,
|
||||
y: x,
|
||||
connects: this._lines[index].connects,
|
||||
index: index,
|
||||
normals: this._lines[index].normals
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
var done = [];
|
||||
@ -286,19 +289,19 @@ D3D.Slicer.prototype._slice = function (layerHeight, height) {
|
||||
|
||||
slices.push(slice);
|
||||
|
||||
if (layer === 218) {
|
||||
/*if (layer === 218) {
|
||||
testData.push({
|
||||
testPoints: testPoints,
|
||||
pathData: slice.parts
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
//console.log(JSON.stringify(testData));
|
||||
|
||||
this.progress.sliced = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
|
||||
return slices;
|
||||
};
|
||||
@ -321,7 +324,7 @@ D3D.Slicer.prototype._generateInnerLines = function (slices, printer) {
|
||||
for (var i = 0; i < slice.parts.length; i ++) {
|
||||
var part = slice.parts[i];
|
||||
|
||||
var outerLine = part.intersect.clone().scaleUp(scale);
|
||||
var outerLine = part.intersect.clone().scaleUp(scale).offset(-nozzleRadius);
|
||||
|
||||
if (outerLine.length > 0) {
|
||||
part.outerLine = outerLine;
|
||||
@ -341,7 +344,7 @@ D3D.Slicer.prototype._generateInnerLines = function (slices, printer) {
|
||||
}
|
||||
|
||||
this.progress.generatedInnerLines = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
};
|
||||
D3D.Slicer.prototype._generateInfills = function (slices, printer) {
|
||||
"use strict";
|
||||
@ -412,7 +415,7 @@ D3D.Slicer.prototype._generateInfills = function (slices, printer) {
|
||||
}
|
||||
|
||||
this.progress.generatedInfills = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
};
|
||||
D3D.Slicer.prototype._generateSupport = function (slices, printer) {
|
||||
"use strict";
|
||||
@ -476,7 +479,7 @@ D3D.Slicer.prototype._generateSupport = function (slices, printer) {
|
||||
}
|
||||
|
||||
this.progress.generatedSupport = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
|
||||
};
|
||||
D3D.Slicer.prototype._optimizePaths = function (slices, printer) {
|
||||
@ -520,7 +523,7 @@ D3D.Slicer.prototype._optimizePaths = function (slices, printer) {
|
||||
}
|
||||
|
||||
this.progress.optimizedPaths = true;
|
||||
this._updateProgress();
|
||||
this._updateProgress(printer);
|
||||
|
||||
}
|
||||
D3D.Slicer.prototype._getFillTemplate = function (bounds, size, even, uneven) {
|
||||
|
Loading…
Reference in New Issue
Block a user