diff --git a/src/kiri/print.js b/src/kiri/print.js index 5d97b2c3..38ec0d61 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -587,7 +587,7 @@ } } }); - lastPoly = output.lastPoly = poly; + lastPoly = slice.lastPoly = poly; } } diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 6fc963a9..9a368da6 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -218,6 +218,7 @@ } } + let lastPoly; let lastLayer; let extruders = []; let extcount = 0; @@ -407,8 +408,8 @@ if (lastLayer && lastLayer.length) { let lastOut = lastLayer.last(); lastOut.retract = true; - if (wipeDist && lastLayer.lastPoly && lastOut.point) { - print.addOutput(lastLayer, lastOut.point.followTo(lastLayer.lastPoly.center(true), wipeDist)); + if (wipeDist && lastPoly && lastOut.point) { + print.addOutput(lastLayer, lastOut.point.followTo(lastPoly.center(true).add(offset), wipeDist)); } } } @@ -416,6 +417,8 @@ ); lastOut = slice; lastExt = lastOut.ext + lastPoly = slice.lastPoly; + lastLayer = layerout; if (layerRetract && layerout.length) { layerout.last().retract = true; } @@ -443,7 +446,6 @@ layerout.layer = layerno++; update((layerno / cake.length) * 0.5, "prepare"); - lastLayer = layerout; slices = []; layerout = []; lastOut = undefined;