stub in layer labels when the code exists to locate proper inscribed rects

This commit is contained in:
Stewart Allen 2023-03-16 17:34:27 -04:00
commit c025d69a0a

View file

@ -105,11 +105,16 @@ function slice(settings, widget, onupdate, ondone) {
}); });
}; };
function polyLabel(poly, label) {
console.log('label', label);
}
function sliceEmitObjects(print, slice, groups, opt = { }) { function sliceEmitObjects(print, slice, groups, opt = { }) {
let start = newPoint(0,0,0); let start = newPoint(0,0,0);
let process = print.settings.process; let process = print.settings.process;
let grouped = process.outputLaserGroup; let grouped = process.outputLaserGroup;
let stacked = process.outputLaserStack; let stacked = process.outputLaserStack;
let label = false && process.outputLaserLabel;
let simple = opt.simple || false; let simple = opt.simple || false;
let group = []; let group = [];
let emit = { in: [], out: [], mark: [] }; let emit = { in: [], out: [], mark: [] };
@ -118,19 +123,22 @@ function sliceEmitObjects(print, slice, groups, opt = { }) {
group.thick = slice.thick; group.thick = slice.thick;
function laserOut(poly, group, type) { function laserOut(poly, group, type, index) {
if (!poly) { if (!poly) {
return; return;
} }
if (Array.isArray(poly)) { if (Array.isArray(poly)) {
poly.forEach(function(pi) { poly.forEach((pi, index) => {
laserOut(pi, group, type); laserOut(pi, group, type, offset.length > 1 ? index : undefined);
}); });
} else { } else {
let pathOpt = zcolor ? {extrude: slice.z, rate: slice.z} : {extrude: 1, rate: 1}; let pathOpt = zcolor ? {extrude: slice.z, rate: slice.z} : {extrude: 1, rate: 1};
if (type === "mark") { if (type === "mark") {
pathOpt.rate = 0.001; pathOpt.rate = 0.001;
pathOpt.extrude = 2; pathOpt.extrude = 2;
} else if (label && type === "out") {
let lbl = index !== undefined ? `${slice.index}-${index}` : `${slice.index}`;
polyLabel(poly, lbl);
} }
if (simple) pathOpt.simple = true; if (simple) pathOpt.simple = true;
if (poly.open) pathOpt.open = true; if (poly.open) pathOpt.open = true;