mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-12-11 16:55:54 +01:00
Untested! Move 'rasterizer' out of loops to get smooth and stable z-behaviour.
Depending on the effect, a switch between both approaches might be a good idea.
This commit is contained in:
parent
73af82a320
commit
2feeaee6a6
@ -89,11 +89,47 @@ function generate_gcode() {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//NOTE: not functional because points are not centered around (0,0)
|
||||
var pmodded = JSON.parse(JSON.stringify(points));
|
||||
var rsMmScaled = rasterSize / screenToMillimeterScale;
|
||||
var pp = null;
|
||||
if (rasterSize > 0) {
|
||||
for (var i = 0; i < pmodded.length; i++) {
|
||||
if (pp == null) pp = pmodded[i];
|
||||
|
||||
pmodded[i][0] = (pmodded[i][0] / rsMmScaled).toFixed(0) * rsMmScaled;
|
||||
pmodded[i][1] = (pmodded[i][1] / rsMmScaled).toFixed(0) * rsMmScaled;
|
||||
|
||||
if (!rasterDiagonals) {
|
||||
if (pp[0] != pmodded[i][0] && pp[1] != pmodded[i][1]) {
|
||||
pp[0] = pmodded[i][0];
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
pp = pmodded[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (var layer = 0; layer < layers; layer++) {
|
||||
|
||||
//gcode.push(";LAYER:"+layer); //this will be added in a next release to support GCODE previewing in CURA
|
||||
|
||||
var p = JSON.parse(JSON.stringify(points)); // [].concat(points);
|
||||
// var p = JSON.parse(JSON.stringify(points)); // [].concat(points);
|
||||
//clone pmodded into p
|
||||
var p = [];
|
||||
for (var i = 0; i < pmodded.length; i++) {
|
||||
var pt = pmodded[i].slice(0);
|
||||
p.push(pt);
|
||||
}
|
||||
|
||||
if (p.length < 2) return;
|
||||
var even = (layer % 2 == 0);
|
||||
@ -163,21 +199,21 @@ function generate_gcode() {
|
||||
var isTraveling = !isLoop && i==0;
|
||||
var doRetract = retractionEnabled && prev.distance(to) > retractionminDistance;
|
||||
|
||||
if (rasterSize > 0) {
|
||||
to.x = (to.x / rasterSize).toFixed(0) * rasterSize;
|
||||
to.y = (to.y / rasterSize).toFixed(0) * rasterSize;
|
||||
}
|
||||
|
||||
if (prevPoint == null) prevPoint = to;
|
||||
|
||||
if (!rasterDiagonals) {
|
||||
if (prevPoint.x != to.x && prevPoint.y != to.y) {
|
||||
to.x = prevPoint.x;
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
prevPoint = to;
|
||||
// if (rasterSize > 0) {
|
||||
// to.x = (to.x / rasterSize).toFixed(0) * rasterSize;
|
||||
// to.y = (to.y / rasterSize).toFixed(0) * rasterSize;
|
||||
// }
|
||||
//
|
||||
// if (prevPoint == null) prevPoint = to;
|
||||
//
|
||||
// if (!rasterDiagonals) {
|
||||
// if (prevPoint.x != to.x && prevPoint.y != to.y) {
|
||||
// to.x = prevPoint.x;
|
||||
// i--;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// prevPoint = to;
|
||||
|
||||
var firstPointEver = (layer == 0 && i == 0 && j == 0);
|
||||
if (firstPointEver || layer > 2 && enableTraveling && isTraveling) { //always travel to first point, then disable traveling for first two layers and use settings for remainder of print
|
||||
|
Loading…
Reference in New Issue
Block a user