mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-21 17:07:55 +01:00
Merge github.com:Doodle3D/doodle3d-client into HEAD
Conflicts: js/gcodeGenerating_v01.js
This commit is contained in:
commit
4f080ef1e4
20
js/gcodeGenerating_v01.js
Normal file → Executable file
20
js/gcodeGenerating_v01.js
Normal file → Executable file
@ -35,7 +35,7 @@ function generate_gcode(callback) {
|
||||
|
||||
// add gcode begin commands
|
||||
gcode = gcode.concat(gcodeStart);
|
||||
|
||||
|
||||
console.log("printer temperature: ",settings["printer.temperature"]);
|
||||
|
||||
gcode.push("M104 S" + settings["printer.temperature"] + " (temperature)");
|
||||
@ -45,7 +45,7 @@ function generate_gcode(callback) {
|
||||
var extruder = 0.0;
|
||||
var prev = new Point(); prev.set(0, 0);
|
||||
|
||||
// vervanger voor ofxGetCenterofMass
|
||||
// replacement (and improvement) for ofxGetCenterofMass
|
||||
var centerOfDoodle = {
|
||||
x: doodleBounds[0] + (doodleBounds[2]- doodleBounds[0])/2,
|
||||
y: doodleBounds[1] + (doodleBounds[3] - doodleBounds[1])/2
|
||||
@ -81,13 +81,14 @@ function generate_gcode(callback) {
|
||||
if (layer == 0) {
|
||||
gcode.push("M107"); //fan off
|
||||
if (firstLayerSlow) gcode.push("M220 S40"); //slow speed
|
||||
} else if (layer == 2) { ////////LET OP
|
||||
} else if (layer == 2) { ////////LET OP, pas bij layer 2 weer op normale snelheid ipv layer 1
|
||||
gcode.push("M106"); //fan on
|
||||
gcode.push("M220 S100"); //normal speed
|
||||
}
|
||||
|
||||
var curLayerCommand = 0;
|
||||
var totalLayerCommands = p.length;
|
||||
var layerProgress = 0;
|
||||
|
||||
var paths = [];
|
||||
var pathCounter = -1;
|
||||
@ -103,12 +104,12 @@ function generate_gcode(callback) {
|
||||
}
|
||||
}
|
||||
// console.log("f:generategcode() >> paths.length: " + paths.length);
|
||||
|
||||
|
||||
// loop over the subpaths (the separately drawn lines)
|
||||
for (var j = 0; j < paths.length; j++) {
|
||||
for (var j = 0; j < paths.length; j++) { // TODO paths > subpaths
|
||||
// this line is probably for drawing efficiency, alternating going from 0->end and end->0 (i.e. to and fro)
|
||||
// vector<ofSubPath::Command> &commands = subpaths[even ? j : subpaths.size()-1-j].getCommands();
|
||||
var commands = paths[j];
|
||||
var commands = paths[j]; //commands zijn alle points uit subpath j // TODO commands > subpathPoints
|
||||
|
||||
// loop over the coordinates of the subpath
|
||||
for (var i = 0; i < commands.length; i++) {
|
||||
@ -122,12 +123,12 @@ function generate_gcode(callback) {
|
||||
|
||||
var isTraveling = !isLoop && i==0;
|
||||
var doRetract = prev.distance(to) > retractionminDistance;
|
||||
|
||||
|
||||
if (enableTraveling && isTraveling) {
|
||||
// console.log("enableTraveling && isTraveling >> doRetract: " + doRetract + ", retractionspeed: " + retractionspeed);
|
||||
if (doRetract) gcode.push("G1 E" + (extruder - retractionamount).toFixed(3) + " F" + (retractionspeed * 60).toFixed(3));
|
||||
if (doRetract) gcode.push("G1 E" + (extruder - retractionamount).toFixed(3) + " F" + (retractionspeed * 60).toFixed(3)); //retract
|
||||
gcode.push("G1 X" + to.x.toFixed(3) + " Y" + to.y.toFixed(3) + " Z" + (z + (doRetract ? hop : 0)).toFixed(3) + " F" + (travelSpeed * 60).toFixed(3));
|
||||
if (doRetract) gcode.push("G1 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3));
|
||||
if (doRetract) gcode.push("G1 E" + extruder.toFixed(3) + " F" + (retractionspeed * 60).toFixed(3)); // return to normal
|
||||
} else {
|
||||
// console.log(" else");
|
||||
extruder += prev.distance(to) * settings["printer.wallThickness"] * settings["printer.layerHeight"] / filamentThickness;
|
||||
@ -135,6 +136,7 @@ function generate_gcode(callback) {
|
||||
}
|
||||
|
||||
curLayerCommand++;
|
||||
layerProgress = curLayerCommand/totalLayerCommands;
|
||||
prev = to;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user