fixes #346 laser marking

This commit is contained in:
Stewart Allen 2025-04-12 17:58:40 -04:00
commit 98320ec7c6
2 changed files with 7 additions and 5 deletions

View file

@ -235,7 +235,6 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
unsafe, unsafe,
color, color,
dark, dark,
// workarea
}; };
let opList = [ let opList = [
@ -275,7 +274,9 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
// apply operation override vars // apply operation override vars
let workover = structuredClone(workarea_orig); let workover = structuredClone(workarea_orig);
let valz = op.op; let valz = op.op;
if (valz.ov_topz) workover.top_z = bottom_stock + valz.ov_topz; if (valz.ov_topz) {
workover.top_z = bottom_stock + valz.ov_topz;
}
if (valz.ov_botz) { if (valz.ov_botz) {
workover.bottom_z = bottom_stock + valz.ov_botz; workover.bottom_z = bottom_stock + valz.ov_botz;
workover.bottom_cut = Math.max(workover.bottom_z, -zThru); workover.bottom_cut = Math.max(workover.bottom_z, -zThru);

View file

@ -68,7 +68,7 @@ function sliceEmitObjects(print, slice, groups, opt = { }) {
pathOpt.rate = 0.001; pathOpt.rate = 0.001;
pathOpt.extrude = 2; pathOpt.extrude = 2;
} else if (label && type === "out") { } else if (label && type === "out") {
let lbl = index !== undefined ? `${slice.index}-${index}` : `${slice.index}`; let lbl = indexed !== undefined ? `${slice.index}-${indexed}` : `${slice.index}`;
polyLabel(poly, lbl); polyLabel(poly, lbl);
} }
if (simple) { if (simple) {
@ -84,7 +84,7 @@ function sliceEmitObjects(print, slice, groups, opt = { }) {
if (ctOutMark && type === "out" && lastEmit) { if (ctOutMark && type === "out" && lastEmit) {
for (let out of lastEmit.out) { for (let out of lastEmit.out) {
if (out.isInside(poly)) { if (out.isInside(poly)) {
polyOut(out, group, "mark"); polyOut(out.clone().setZ(poly.getZ()), group, "mark");
} }
} }
} }
@ -375,7 +375,8 @@ async function prepare(widgets, settings, update) {
} }
} }
let lastEmit; let lastEmit;
for (let slice of widget.slices.reverse()) { let slices = ctOutStack ? widget.slices.reverse() : widget.slices;
for (let slice of slices) {
lastEmit = sliceEmitObjects(print, slice, layers, {simple: isKnife, lastEmit}); lastEmit = sliceEmitObjects(print, slice, layers, {simple: isKnife, lastEmit});
update((slices++ / totalSlices) * 0.5, "prepare"); update((slices++ / totalSlices) * 0.5, "prepare");
} }