separate interior brims from side brims and make each configurable

This commit is contained in:
Stewart Allen 2021-04-21 21:35:37 -04:00
commit 5dcbbdef10
4 changed files with 26 additions and 14 deletions

View file

@ -508,6 +508,7 @@
for (let layer of output) {
let params = getRangeParameters(settings, layer.layer || 0);
let firstLayerBrim = params.firstLayerBrim;
let firstLayerBrimIn = params.firstLayerBrimIn;
let firstLayerBrimTrig = params.firstLayerBrimTrig;
let firstLayerBrimComb = params.firstLayerBrimComb;
let firstLayerBrimGap = params.firstLayerBrimGap || 0;
@ -546,40 +547,47 @@
}
let tmpout = [];
let trigmet = firstLayerBrimTrig === 0 || (firstLayerBrimTrig && mins > firstLayerBrimTrig);
let brimax = Math.max(firstLayerBrim, firstLayerBrimIn);
// add brim when all conditions met
if (firstLayerBrim && seqn <= firstLayerBrimComb && trigmet) {
if (brimax && seqn <= firstLayerBrimComb && trigmet) {
let { emit, tool } = first;
let y = maxy;
let z = minz;
let g = firstLayerBrimGap || 0;
let b = Math.max(firstLayerBrim, 1) + g;
let bi = Math.max(firstLayerBrimIn, 1) + g;
layer.last().retract = true;
print.addOutput(tmpout, newPoint(maxx + b, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(maxx + g, y, z), emit, firstLayerRate, tool).retract = true;
if (pads.length > 1) {
// outside brim
if (firstLayerBrim) {
print.addOutput(tmpout, newPoint(maxx + b, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(maxx + g, y, z), emit, firstLayerRate, tool).retract = true;
}
// inside brim
if (firstLayerBrimIn && pads.length > 1) {
let gaps = [];
let lpad = pads[0];
for (let pad of pads.slice(1)) {
let x0 = lpad[1];
let x1 = pad[0];
lpad = pad;
if (x1 - x0 > b * 2) {
if (x1 - x0 > bi * 2) {
// over 2x brim so emit two segments
print.addOutput(tmpout, newPoint(x1 - g, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(x1 - b, y, z), emit, firstLayerRate, tool).retract = true;
print.addOutput(tmpout, newPoint(x0 + b, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(x1 - bi, y, z), emit, firstLayerRate, tool).retract = true;
print.addOutput(tmpout, newPoint(x0 + bi, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(x0 + g, y, z), emit, firstLayerRate, tool).retract = true;
} else if (x1 - x0 > b / 3) {
} else if (x1 - x0 > bi / 3) {
// over 1/3rd brim length emit single segment
print.addOutput(tmpout, newPoint(x1 - g, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(x0 + g, y, z), emit, firstLayerRate, tool).retract = true;
}
}
}
print.addOutput(tmpout, newPoint(minx - b, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(minx - g, y, z), emit, firstLayerRate, tool).retract = false;
// outside brim
if (firstLayerBrim) {
print.addOutput(tmpout, newPoint(minx - b, y, z), 0, firstLayerSeek, tool);
print.addOutput(tmpout, newPoint(minx - g, y, z), emit, firstLayerRate, tool).retract = false;
}
if (firstLayerBrimComb) {
seqn++;
}