mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
Fixed major bug
This commit is contained in:
parent
bdb98fbfff
commit
7bfacf5203
@ -74,7 +74,7 @@ D3D.Box.prototype.init = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.updateLoop();
|
scope.updateState();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ D3D.Box.prototype.updateLoop = function () {
|
|||||||
//Bij error wordt gelijk zelfde data opnieuw gestuurd
|
//Bij error wordt gelijk zelfde data opnieuw gestuurd
|
||||||
//Als DoodleBox ontkoppeld wordt komt er een error in de loop waardoor pagina breekt en ververst moet worden
|
//Als DoodleBox ontkoppeld wordt komt er een error in de loop waardoor pagina breekt en ververst moet worden
|
||||||
|
|
||||||
if (this.printBatches.length > 0 && (this.status["buffered_lines"] + this.batches[0].length) <= this.maxBufferedLines) {
|
if (this.printBatches.length > 0 && (this.status["buffered_lines"] + this.printBatches[0].length) <= this.maxBufferedLines) {
|
||||||
//if (this.printBatches.length > 0 ) {
|
//if (this.printBatches.length > 0 ) {
|
||||||
this.printBatch();
|
this.printBatch();
|
||||||
}
|
}
|
||||||
|
22
src/gcode.js
22
src/gcode.js
@ -19,9 +19,9 @@ D3D.GCode = function () {
|
|||||||
this.bottom = true;
|
this.bottom = true;
|
||||||
this.isRetracted = false;
|
this.isRetracted = false;
|
||||||
this.isFanOn = false;
|
this.isFanOn = false;
|
||||||
this.nozzlePosition = new THREE.Vector2(0, 0);
|
this._nozzlePosition = new THREE.Vector2(0, 0);
|
||||||
};
|
};
|
||||||
D3D.GCode.prototype.addGCode = function (command) {
|
D3D.GCode.prototype._addGCode = function (command) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var str = [];
|
var str = [];
|
||||||
@ -62,7 +62,7 @@ D3D.GCode.prototype.turnFanOn = function (fanSpeed) {
|
|||||||
gcode["S"] = fanSpeed;
|
gcode["S"] = fanSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addGCode(gcode);
|
this._addGCode(gcode);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -71,7 +71,7 @@ D3D.GCode.prototype.turnFanOff = function () {
|
|||||||
|
|
||||||
this.isFanOn = false;
|
this.isFanOn = false;
|
||||||
|
|
||||||
this.addGCode({
|
this._addGCode({
|
||||||
"M": 107
|
"M": 107
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -86,13 +86,13 @@ D3D.GCode.prototype.moveTo = function (x, y, layer) {
|
|||||||
var z = (layer + 1) * layerHeight;
|
var z = (layer + 1) * layerHeight;
|
||||||
var speed = travelSpeed * 60;
|
var speed = travelSpeed * 60;
|
||||||
|
|
||||||
this.addGCode({
|
this._addGCode({
|
||||||
"G": 0,
|
"G": 0,
|
||||||
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
|
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
|
||||||
"F": speed.toFixed(3)
|
"F": speed.toFixed(3)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nozzlePosition.set(x, y);
|
this._nozzlePosition.set(x, y);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -112,19 +112,19 @@ D3D.GCode.prototype.lineTo = function (x, y, layer, type) {
|
|||||||
var flowRate = profile["flowRate"];
|
var flowRate = profile["flowRate"];
|
||||||
var z = (layer + 1) * layerHeight;
|
var z = (layer + 1) * layerHeight;
|
||||||
|
|
||||||
var lineLength = this.nozzlePosition.distanceTo(newNozzlePosition);
|
var lineLength = this._nozzlePosition.distanceTo(newNozzlePosition);
|
||||||
|
|
||||||
var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI;
|
var filamentSurfaceArea = Math.pow((filamentThickness/2), 2) * Math.PI;
|
||||||
this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate;
|
this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate;
|
||||||
|
|
||||||
this.addGCode({
|
this._addGCode({
|
||||||
"G": 1,
|
"G": 1,
|
||||||
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
|
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
|
||||||
"F": speed.toFixed(3),
|
"F": speed.toFixed(3),
|
||||||
"E": this.extruder.toFixed(3)
|
"E": this.extruder.toFixed(3)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nozzlePosition.copy(newNozzlePosition);
|
this._nozzlePosition.copy(newNozzlePosition);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@ -141,7 +141,7 @@ D3D.GCode.prototype.unRetract = function () {
|
|||||||
var speed = retractionSpeed * 60;
|
var speed = retractionSpeed * 60;
|
||||||
|
|
||||||
if (this.extruder > retractionMinDistance) {
|
if (this.extruder > retractionMinDistance) {
|
||||||
this.addGCode({
|
this._addGCode({
|
||||||
"G": 0,
|
"G": 0,
|
||||||
"E": this.extruder.toFixed(3),
|
"E": this.extruder.toFixed(3),
|
||||||
"F": speed.toFixed(3)
|
"F": speed.toFixed(3)
|
||||||
@ -165,7 +165,7 @@ D3D.GCode.prototype.retract = function () {
|
|||||||
var speed = retractionSpeed * 60;
|
var speed = retractionSpeed * 60;
|
||||||
|
|
||||||
if (this.extruder > retractionMinDistance && retractionEnabled) {
|
if (this.extruder > retractionMinDistance && retractionEnabled) {
|
||||||
this.addGCode({
|
this._addGCode({
|
||||||
"G": 0,
|
"G": 0,
|
||||||
"E": (this.extruder - retractionAmount).toFixed(3),
|
"E": (this.extruder - retractionAmount).toFixed(3),
|
||||||
"F": speed.toFixed(3)
|
"F": speed.toFixed(3)
|
||||||
|
@ -129,12 +129,9 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
|
|||||||
|
|
||||||
var slices = [];
|
var slices = [];
|
||||||
|
|
||||||
//still error in first layer, so remove first layer & last layer
|
|
||||||
//see https://github.com/Doodle3D/Doodle3D-Slicer/issues/1
|
|
||||||
for (var layer = 1; layer < layersIntersections.length; layer ++) {
|
for (var layer = 1; layer < layersIntersections.length; layer ++) {
|
||||||
var layerIntersections = layersIntersections[layer];
|
var layerIntersections = layersIntersections[layer];
|
||||||
|
|
||||||
//why have a slice with only support?
|
|
||||||
if (layerIntersections.length > 0) {
|
if (layerIntersections.length > 0) {
|
||||||
|
|
||||||
var y = layer * layerHeight;
|
var y = layer * layerHeight;
|
||||||
@ -205,7 +202,6 @@ D3D.Slicer.prototype.slice = function (layerHeight, height) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//think this check is not nescesary, always higher as 0
|
|
||||||
if (shape.length > 1) {
|
if (shape.length > 1) {
|
||||||
var part = new D3D.Paths([shape]).clean(0.01);
|
var part = new D3D.Paths([shape]).clean(0.01);
|
||||||
sliceParts.push(part);
|
sliceParts.push(part);
|
||||||
@ -451,7 +447,7 @@ D3D.Slicer.prototype.getFillTemplate = function (bounds, size, even, uneven) {
|
|||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
};
|
};
|
||||||
D3D.Slicer.prototype.dataToGCode = function (data, printer) {
|
D3D.Slicer.prototype.dataToGCode = function (slices, printer) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var gcode = new D3D.GCode().setSettings(printer);
|
var gcode = new D3D.GCode().setSettings(printer);
|
||||||
@ -484,8 +480,8 @@ D3D.Slicer.prototype.dataToGCode = function (data, printer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var layer = 0; layer < data.length; layer ++) {
|
for (var layer = 0; layer < slices.length; layer ++) {
|
||||||
var slice = data[layer];
|
var slice = slices[layer];
|
||||||
|
|
||||||
if (layer === 1) {
|
if (layer === 1) {
|
||||||
gcode.turnFanOn();
|
gcode.turnFanOn();
|
||||||
|
Loading…
Reference in New Issue
Block a user