fix contour rendering

This commit is contained in:
Stewart Allen 2020-11-11 17:33:20 -05:00
commit 6e18fd2466
3 changed files with 17 additions and 18 deletions

View file

@ -2,7 +2,6 @@
NEXT
- contour outside part boundaries
- fdm first level height render
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
@ -16,8 +15,7 @@ NEXT
# FDM
* `B` fix preview/gcode layer size (first layer)
* `B` fix adaptive slicing with multi-extruder
* `B` fix adaptive slicing. also with multi-extruder
* `B` fix supports with grouped parts
* `F` speculative background preview generation
* `F` control for size of purge block (with 0=disabled)

View file

@ -35,7 +35,15 @@
print.render = KIRI.driver.FDM.prepareRender(print.output, progress => {
update(0.5 + progress * 0.5);
}, { thin: true, print: 0, move: 0x003366, speed: false, moves: true });
}, {
thin: true,
print: 0,
move: 0x003366,
speed: false,
moves: true,
other: "moving",
action: "milling"
});
return print.render;
};

View file

@ -436,23 +436,18 @@
const output = new KIRI.Render();
layers.push(output);
// const updateTool = (toolid) => {
// toolid = toolid || 0;
// const array = prints[toolid] = prints[toolid] || [];
// const tool = tools[toolid] || {};
// array.width = (tool.extNozzle || 1) / 2;
// }
const pushPrint = (toolid, poly) => {
toolid = toolid || 0;
const array = prints[toolid] = prints[toolid] || [];
const tool = tools[toolid] || {};
array.width = (tool.extNozzle || 1) / 2;
array.push(poly);
emits++;
};
let height = level.height / 2;
let width = 1;
let emits = 0;
level.forEach(out => {
if (!out.point) {
@ -469,7 +464,6 @@
current.color = color(out);
pushPrint(out.tool, current);
}
// updateTool(out.tool);
current.push(out.point);
} else {
if (lastOut.emit) {
@ -491,13 +485,12 @@
}
lastOut = out;
});
// if (lastOut.emit) {
// pushPrint(lastOut.tool, current)
// } else {
// moves.push(current);
// }
// all moves with an emit at the very end (common in contouring)
if (lastOut.emit && !emits) {
pushPrint(lastOut.tool, current)
}
output
.setLayer('move', moveColor, opts.moves !== true)
.setLayer(opts.other || 'move', moveColor, opts.moves !== true)
.addPolys(moves, { thin: true, z: opts.z });
Object.values(prints).forEach(array => {
array.forEach(poly => { if (poly.length > 1) output