From 6e18fd2466ef8bf01465c93d2ae6950341b960a9 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 11 Nov 2020 17:33:20 -0500 Subject: [PATCH] fix contour rendering --- notes.md | 4 +--- src/mode/cam/prepare.js | 10 +++++++++- src/mode/fdm/prepare.js | 21 +++++++-------------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/notes.md b/notes.md index b68034e2..00f2e77c 100644 --- a/notes.md +++ b/notes.md @@ -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) diff --git a/src/mode/cam/prepare.js b/src/mode/cam/prepare.js index 08aba251..1e7db02e 100644 --- a/src/mode/cam/prepare.js +++ b/src/mode/cam/prepare.js @@ -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; }; diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 2dd20cff..899e9222 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -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