fix conflict between laser stack and drag knife output
This commit is contained in:
parent
8fef68d598
commit
bd478d66f9
1 changed files with 14 additions and 11 deletions
|
|
@ -267,7 +267,8 @@ async function prepare(widgets, settings, update) {
|
||||||
process = settings.process,
|
process = settings.process,
|
||||||
print = self.worker.print = kiri.newPrint(settings, widgets),
|
print = self.worker.print = kiri.newPrint(settings, widgets),
|
||||||
isWire = self.worker.mode === 'WEDM',
|
isWire = self.worker.mode === 'WEDM',
|
||||||
knifeOn = self.worker.mode === 'DRAG',
|
isKnife = self.worker.mode === 'DRAG',
|
||||||
|
isLaser = self.worker.mode === 'LASER',
|
||||||
output = print.output = [],
|
output = print.output = [],
|
||||||
totalSlices = 0,
|
totalSlices = 0,
|
||||||
slices = 0,
|
slices = 0,
|
||||||
|
|
@ -278,6 +279,8 @@ async function prepare(widgets, settings, update) {
|
||||||
{ ctOriginOffX, ctOriginOffY } = process,
|
{ ctOriginOffX, ctOriginOffY } = process,
|
||||||
{ ctOutStack, ctOutMerged, ctOutKnifeTip, ctOutShaper } = process;
|
{ ctOutStack, ctOutMerged, ctOutKnifeTip, ctOutShaper } = process;
|
||||||
|
|
||||||
|
ctOutStack = ctOutStack && isLaser;
|
||||||
|
|
||||||
// shim to adapt older code -- should be refactored
|
// shim to adapt older code -- should be refactored
|
||||||
// let pppo = [];
|
// let pppo = [];
|
||||||
let pppg = [];
|
let pppg = [];
|
||||||
|
|
@ -350,7 +353,7 @@ async function prepare(widgets, settings, update) {
|
||||||
}
|
}
|
||||||
let gather = [];
|
let gather = [];
|
||||||
for (let poly of merged) {
|
for (let poly of merged) {
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
addKnifeRadii(poly, ctOutKnifeTip);
|
addKnifeRadii(poly, ctOutKnifeTip);
|
||||||
}
|
}
|
||||||
print.PPP(poly, gather, {
|
print.PPP(poly, gather, {
|
||||||
|
|
@ -361,7 +364,7 @@ async function prepare(widgets, settings, update) {
|
||||||
layers.push(gather);
|
layers.push(gather);
|
||||||
} else {
|
} else {
|
||||||
// output a layer for each slice
|
// output a layer for each slice
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
for (let slice of widget.slices) {
|
for (let slice of widget.slices) {
|
||||||
for (let poly of slice.offset) {
|
for (let poly of slice.offset) {
|
||||||
addKnifeRadii(poly, ctOutKnifeTip);
|
addKnifeRadii(poly, ctOutKnifeTip);
|
||||||
|
|
@ -373,7 +376,7 @@ async function prepare(widgets, settings, update) {
|
||||||
}
|
}
|
||||||
let lastEmit;
|
let lastEmit;
|
||||||
for (let slice of widget.slices.reverse()) {
|
for (let slice of widget.slices.reverse()) {
|
||||||
lastEmit = sliceEmitObjects(print, slice, layers, {simple: knifeOn, lastEmit});
|
lastEmit = sliceEmitObjects(print, slice, layers, {simple: isKnife, lastEmit});
|
||||||
update((slices++ / totalSlices) * 0.5, "prepare");
|
update((slices++ / totalSlices) * 0.5, "prepare");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -468,7 +471,7 @@ async function prepare(widgets, settings, update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update(0.5 + progress * 0.5, "render", layer);
|
update(0.5 + progress * 0.5, "render", layer);
|
||||||
}, { thin: true, z: ctOutStack ? undefined : 0, action: "cut", moves: process.knifeOn });
|
}, { thin: true, z: ctOutStack ? undefined : 0, action: "cut", moves: process.isKnife });
|
||||||
};
|
};
|
||||||
|
|
||||||
function exportLaser(print, online, ondone) {
|
function exportLaser(print, online, ondone) {
|
||||||
|
|
@ -602,9 +605,9 @@ function exportGCode(settings, data) {
|
||||||
let power = max_power;
|
let power = max_power;
|
||||||
let cut_on = dev.gcodeLaserOn || dev.gcodeWaterOn || dev.gcodeKnifeDn || [];
|
let cut_on = dev.gcodeLaserOn || dev.gcodeWaterOn || dev.gcodeKnifeDn || [];
|
||||||
let cut_off = dev.gcodeLaserOff || dev.gcodeWaterOff || dev.gcodeKnifeUp || [];
|
let cut_off = dev.gcodeLaserOff || dev.gcodeWaterOff || dev.gcodeKnifeUp || [];
|
||||||
let knifeOn = proc.knifeOn;
|
let isKnife = proc.isKnife;
|
||||||
let knifeDepth = proc.ctOutKnifeDepth;
|
let knifeDepth = proc.ctOutKnifeDepth;
|
||||||
let passes = knifeOn ? proc.ctOutKnifePasses : 1;
|
let passes = isKnife ? proc.ctOutKnifePasses : 1;
|
||||||
|
|
||||||
exportElements(
|
exportElements(
|
||||||
settings,
|
settings,
|
||||||
|
|
@ -623,18 +626,18 @@ function exportGCode(settings, data) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(poly, color, thick) {
|
function(poly, color, thick) {
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
lines.push(`; start new poly id=${poly.id} len=${poly.length}`);
|
lines.push(`; start new poly id=${poly.id} len=${poly.length}`);
|
||||||
}
|
}
|
||||||
for (let i=1; i<passes + 1; i++) {
|
for (let i=1; i<passes + 1; i++) {
|
||||||
poly.forEach(function(point, index) {
|
poly.forEach(function(point, index) {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
// lift
|
// lift
|
||||||
lines.appendAll(['; drag-knife lift', `G0${space}Z5`]);
|
lines.appendAll(['; drag-knife lift', `G0${space}Z5`]);
|
||||||
}
|
}
|
||||||
lines.push(`G0${space}${point}`);
|
lines.push(`G0${space}${point}`);
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
// drop
|
// drop
|
||||||
lines.appendAll(['; drag-knife down', `G0${space}Z${-i * knifeDepth}`]);
|
lines.appendAll(['; drag-knife down', `G0${space}Z${-i * knifeDepth}`]);
|
||||||
}
|
}
|
||||||
|
|
@ -655,7 +658,7 @@ function exportGCode(settings, data) {
|
||||||
lines.push(line);
|
lines.push(line);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (knifeOn) {
|
if (isKnife) {
|
||||||
lines.appendAll([`G0${space}Z5`]);
|
lines.appendAll([`G0${space}Z5`]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue