handle the case of no outlines

This commit is contained in:
Stewart Allen 2020-12-20 11:07:39 -05:00
commit a58f0f7aa9

View file

@ -491,12 +491,14 @@
let flatLevels = depthData.map(level => { let flatLevels = depthData.map(level => {
return POLY.flatten(level.clone(true), [], true).filter(p => !(p.depth = 0)); return POLY.flatten(level.clone(true), [], true).filter(p => !(p.depth = 0));
}).filter(l => l.length > 0); }).filter(l => l.length > 0);
// start with the smallest polygon on the top if (flatLevels.length && flatLevels[0].length) {
printPoint = flatLevels[0] // start with the smallest polygon on the top
.sort((a,b) => { return a.area() - b.area() })[0] printPoint = flatLevels[0]
.average(); .sort((a,b) => { return a.area() - b.area() })[0]
printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, false); .average();
printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, true); printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, false);
printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, true);
}
} }
setPrintPoint(printPoint); setPrintPoint(printPoint);