add layer order laser output option
This commit is contained in:
parent
a359785d21
commit
c1b44e4301
6 changed files with 51 additions and 14 deletions
|
|
@ -486,6 +486,7 @@
|
||||||
outputLaserPower: 100,
|
outputLaserPower: 100,
|
||||||
outputLaserSpeed: 1000,
|
outputLaserSpeed: 1000,
|
||||||
outputLaserGroup: true,
|
outputLaserGroup: true,
|
||||||
|
outputLaserLayer: false,
|
||||||
outputLaserMerged: false,
|
outputLaserMerged: false,
|
||||||
outputOriginCenter: true,
|
outputOriginCenter: true,
|
||||||
outputInvertX: false,
|
outputInvertX: false,
|
||||||
|
|
|
||||||
|
|
@ -1456,6 +1456,7 @@
|
||||||
outputLaserSpeed: UC.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:UC.toInt, modes:LASER}),
|
outputLaserSpeed: UC.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:UC.toInt, modes:LASER}),
|
||||||
outputLaserMerged: UC.newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:LASER}),
|
outputLaserMerged: UC.newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:LASER}),
|
||||||
outputLaserGroup: UC.newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, modes:LASER}),
|
outputLaserGroup: UC.newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, modes:LASER}),
|
||||||
|
outputLaserLayer: UC.newBoolean(LANG.ou_layr_s, onBooleanClick, {title:LANG.ou_layr_l, modes:LASER}),
|
||||||
outputTemp: UC.newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:UC.toInt, modes:FDM}),
|
outputTemp: UC.newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:UC.toInt, modes:FDM}),
|
||||||
outputBedTemp: UC.newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:UC.toInt, modes:FDM}),
|
outputBedTemp: UC.newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:UC.toInt, modes:FDM}),
|
||||||
outputFeedrate: UC.newInput(LANG.ou_feed_s, {title:LANG.ou_feed_l, convert:UC.toInt, modes:FDM}),
|
outputFeedrate: UC.newInput(LANG.ou_feed_s, {title:LANG.ou_feed_l, convert:UC.toInt, modes:FDM}),
|
||||||
|
|
|
||||||
|
|
@ -1291,13 +1291,12 @@
|
||||||
let i, m, sz = SPACE.platform.size(),
|
let i, m, sz = SPACE.platform.size(),
|
||||||
mp = [sz.x, sz.y],
|
mp = [sz.x, sz.y],
|
||||||
ms = [mp[0] / 2, mp[1] / 2],
|
ms = [mp[0] / 2, mp[1] / 2],
|
||||||
mi = mp[0] > mp[1] ? [(mp[0] / mp[1]) * 10, 10] : [10, (mp[1] / mp[1]) * 10],
|
c = Widget.Groups.blocks().sort(MOTO.Sort),
|
||||||
c = Widget.Groups.blocks().sort(function (a, b) { return (b.w * b.h) - (a.w * a.h) }),
|
|
||||||
p = new MOTO.Pack(ms[0], ms[1], gap).fit(c);
|
p = new MOTO.Pack(ms[0], ms[1], gap).fit(c);
|
||||||
|
|
||||||
while (!p.packed) {
|
while (!p.packed) {
|
||||||
ms[0] += mi[0];
|
ms[0] *= 1.1;
|
||||||
ms[1] += mi[1];
|
ms[1] *= 1.1;
|
||||||
p = new MOTO.Pack(ms[0], ms[1], gap).fit(c);
|
p = new MOTO.Pack(ms[0], ms[1], gap).fit(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,18 +181,18 @@
|
||||||
// do object layout packing
|
// do object layout packing
|
||||||
let i, m, e,
|
let i, m, e,
|
||||||
MOTO = self.moto,
|
MOTO = self.moto,
|
||||||
mp = [device.bedWidth, device.bedDepth],
|
dw = device.bedWidth / 2,
|
||||||
ms = [mp[0] / 2, mp[1] / 2],
|
dh = device.bedDepth / 2,
|
||||||
mi = mp[0] > mp[1] ? [(mp[0] / mp[1]) * 10, 10] : [10, (mp[1] / mp[1]) * 10],
|
sort = !process.outputLaserLayer,
|
||||||
// sort objects by size
|
// sort objects by size when not using laser layer ordering
|
||||||
c = output.sort(function (a, b) { return (b.w * b.h) - (a.w * a.h) }),
|
c = sort ? output.sort(MOTO.Sort) : output,
|
||||||
p = new MOTO.Pack(ms[0], ms[1], process.outputTileSpacing).fit(c);
|
p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c, !sort);
|
||||||
|
|
||||||
// test different ratios until packed
|
// test different ratios until packed
|
||||||
while (!p.packed) {
|
while (!p.packed) {
|
||||||
ms[0] += mi[0];
|
dw *= 1.1;
|
||||||
ms[1] += mi[1];
|
dh *= 1.1;
|
||||||
p = new MOTO.Pack(ms[0], ms[1], process.outputTileSpacing).fit(c);
|
p = new MOTO.Pack(dw, dh, process.outputTileSpacing).fit(c ,!sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < c.length; i++) {
|
for (i = 0; i < c.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@
|
||||||
if (self.moto.Pack) return;
|
if (self.moto.Pack) return;
|
||||||
|
|
||||||
self.moto.Pack = Packer;
|
self.moto.Pack = Packer;
|
||||||
|
self.moto.Sort = function (a, b) {
|
||||||
|
let aa = (a.w * a.h);
|
||||||
|
let ab = (b.w * b.h);
|
||||||
|
if (Math.abs(aa-ab) < 1) {
|
||||||
|
return (b.w / b.h) - (a.w / a.h);
|
||||||
|
} else {
|
||||||
|
return ab - aa;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function Packer (w, h, spacing) {
|
function Packer (w, h, spacing) {
|
||||||
this.root = { x: 0, y: 0, w: w, h: h };
|
this.root = { x: 0, y: 0, w: w, h: h };
|
||||||
|
|
@ -24,7 +33,32 @@
|
||||||
|
|
||||||
Packer.prototype = {
|
Packer.prototype = {
|
||||||
|
|
||||||
fit: function (blocks) {
|
simple: function (blocks) {
|
||||||
|
let n = 0, block, x = 0, y = 0, mh = 0;
|
||||||
|
while (n < blocks.length) {
|
||||||
|
block = blocks[n++];
|
||||||
|
block.fit = { x, y };
|
||||||
|
this.max.w = Math.max(this.max.w, x + block.w);
|
||||||
|
this.max.h = Math.max(this.max.h, y + block.h);
|
||||||
|
mh = Math.max(mh, block.h);
|
||||||
|
x += block.w + this.spacing;
|
||||||
|
if (x > this.root.w) {
|
||||||
|
x = 0;
|
||||||
|
y += mh + this.spacing;
|
||||||
|
mh = 0;
|
||||||
|
}
|
||||||
|
if (y > this.root.h) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.packed = true;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
fit: function (blocks, simple) {
|
||||||
|
if (simple) {
|
||||||
|
return this.simple(blocks);
|
||||||
|
}
|
||||||
let n = 0, node, block, w, h;
|
let n = 0, node, block, w, h;
|
||||||
while (n < blocks.length) {
|
while (n < blocks.length) {
|
||||||
block = blocks[n++];
|
block = blocks[n++];
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,8 @@ kiri.lang['en-us'] = {
|
||||||
ou_mrgd_l: "merge all layers using\ncolor coding to denote\nstacking depth",
|
ou_mrgd_l: "merge all layers using\ncolor coding to denote\nstacking depth",
|
||||||
ou_grpd_s: "grouped",
|
ou_grpd_s: "grouped",
|
||||||
ou_grpd_l: "retain each layer as\na unified grouping\ninstead of separated\npolygons",
|
ou_grpd_l: "retain each layer as\na unified grouping\ninstead of separated\npolygons",
|
||||||
|
ou_layr_s: "layer order",
|
||||||
|
ou_layr_l: "output layer order\nfrom top right to\nbottom left",
|
||||||
|
|
||||||
// OUTPUT FDM
|
// OUTPUT FDM
|
||||||
ou_nozl_s: "nozzle temp",
|
ou_nozl_s: "nozzle temp",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue