fix laser output for centering

This commit is contained in:
Stewart Allen 2019-05-24 14:15:54 -04:00
commit 6e71caae04
2 changed files with 17 additions and 2 deletions

View file

@ -186,8 +186,8 @@ var gs_kiri_laser = exports;
}); });
}); });
// normalize against origin lower left
if (!process.outputOriginCenter) { if (!process.outputOriginCenter) {
// normalize against origin lower left
output.forEach(function(layer) { output.forEach(function(layer) {
layer.forEach(function(out) { layer.forEach(function(out) {
point = out.point; point = out.point;
@ -199,6 +199,21 @@ var gs_kiri_laser = exports;
max.y = max.y - min.y; max.y = max.y - min.y;
min.x = 0; min.x = 0;
min.y = 0; min.y = 0;
} else {
// normalize against center of build area
let w = print.settings.device.bedWidth;
let h = print.settings.device.bedDepth;
output.forEach(function(layer) {
layer.forEach(function(out) {
point = out.point;
point.x += w/2;
point.y += h/2;
});
});
max.x = w;
max.y = h;
min.x = 0;
min.y = 0;
} }
onpre(min, max, process.outputLaserPower, process.outputLaserSpeed); onpre(min, max, process.outputLaserPower, process.outputLaserSpeed);

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) 2014-2019 Stewart Allen <sa@grid.space> - All Rights Reserved", COPYRIGHT:"Copyright (C) 2014-2019 Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE:"See the license.md file included with the source distribution", LICENSE:"See the license.md file included with the source distribution",
VERSION:"1.4.2" VERSION:"1.4.3"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;