mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Merge github.com:Doodle3D/doodle3d-client into HEAD
Conflicts: js/gcodeGenerating_v01.js
This commit is contained in:
commit
4f080ef1e4
14
js/gcodeGenerating_v01.js
Normal file → Executable file
14
js/gcodeGenerating_v01.js
Normal file → Executable file
@ -45,7 +45,7 @@ function generate_gcode(callback) {
|
|||||||
var extruder = 0.0;
|
var extruder = 0.0;
|
||||||
var prev = new Point(); prev.set(0, 0);
|
var prev = new Point(); prev.set(0, 0);
|
||||||
|
|
||||||
// vervanger voor ofxGetCenterofMass
|
// replacement (and improvement) for ofxGetCenterofMass
|
||||||
var centerOfDoodle = {
|
var centerOfDoodle = {
|
||||||
x: doodleBounds[0] + (doodleBounds[2]- doodleBounds[0])/2,
|
x: doodleBounds[0] + (doodleBounds[2]- doodleBounds[0])/2,
|
||||||
y: doodleBounds[1] + (doodleBounds[3] - doodleBounds[1])/2
|
y: doodleBounds[1] + (doodleBounds[3] - doodleBounds[1])/2
|
||||||
@ -81,13 +81,14 @@ function generate_gcode(callback) {
|
|||||||
if (layer == 0) {
|
if (layer == 0) {
|
||||||
gcode.push("M107"); //fan off
|
gcode.push("M107"); //fan off
|
||||||
if (firstLayerSlow) gcode.push("M220 S40"); //slow speed
|
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("M106"); //fan on
|
||||||
gcode.push("M220 S100"); //normal speed
|
gcode.push("M220 S100"); //normal speed
|
||||||
}
|
}
|
||||||
|
|
||||||
var curLayerCommand = 0;
|
var curLayerCommand = 0;
|
||||||
var totalLayerCommands = p.length;
|
var totalLayerCommands = p.length;
|
||||||
|
var layerProgress = 0;
|
||||||
|
|
||||||
var paths = [];
|
var paths = [];
|
||||||
var pathCounter = -1;
|
var pathCounter = -1;
|
||||||
@ -105,10 +106,10 @@ function generate_gcode(callback) {
|
|||||||
// console.log("f:generategcode() >> paths.length: " + paths.length);
|
// console.log("f:generategcode() >> paths.length: " + paths.length);
|
||||||
|
|
||||||
// loop over the subpaths (the separately drawn lines)
|
// 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)
|
// 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();
|
// 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
|
// loop over the coordinates of the subpath
|
||||||
for (var i = 0; i < commands.length; i++) {
|
for (var i = 0; i < commands.length; i++) {
|
||||||
@ -125,9 +126,9 @@ function generate_gcode(callback) {
|
|||||||
|
|
||||||
if (enableTraveling && isTraveling) {
|
if (enableTraveling && isTraveling) {
|
||||||
// console.log("enableTraveling && isTraveling >> doRetract: " + doRetract + ", retractionspeed: " + retractionspeed);
|
// 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));
|
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 {
|
} else {
|
||||||
// console.log(" else");
|
// console.log(" else");
|
||||||
extruder += prev.distance(to) * settings["printer.wallThickness"] * settings["printer.layerHeight"] / filamentThickness;
|
extruder += prev.distance(to) * settings["printer.wallThickness"] * settings["printer.layerHeight"] / filamentThickness;
|
||||||
@ -135,6 +136,7 @@ function generate_gcode(callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
curLayerCommand++;
|
curLayerCommand++;
|
||||||
|
layerProgress = curLayerCommand/totalLayerCommands;
|
||||||
prev = to;
|
prev = to;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user