fix contour rendering
This commit is contained in:
parent
e5956bd4c9
commit
6e18fd2466
3 changed files with 17 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue