add clip-to-stock for roughing and outlines

This commit is contained in:
Stewart Allen 2021-01-06 12:32:32 -05:00
commit 7aee1b19a5
7 changed files with 31 additions and 7 deletions

View file

@ -105,8 +105,9 @@
slice(progress) {
let { op, state } = this;
let { settings, widget, slicer, sliceAll, unsafe } = state;
let { updateToolDiams, thruHoles, tabs, cutTabs } = state;
let { updateToolDiams, thruHoles, tabs, cutTabs, cutPolys } = state;
let { tshadow, shadowTop, ztOff, zBottom, zMax } = state;
let { process, stock } = settings;
let roughIn = op.inside;
let roughTop = op.top;
@ -261,6 +262,11 @@
if (!offset) return;
if (process.camStockClipTo) {
let rect = newPolygon().centerRectangle(stock.center, stock.x, stock.y);
offset = cutPolys([rect], offset, slice.z, true);
}
// elimate double inset on inners
offset.forEach(op => {
if (op.inner) {
@ -376,7 +382,8 @@
slice(progress) {
let { op, state } = this;
let { settings, widget, slicer, sliceAll, tshadow, thruHoles, unsafe } = state;
let { updateToolDiams, zThru, zBottom, shadowTop, tabs, cutTabs } = state;
let { updateToolDiams, zThru, zBottom, shadowTop, tabs, cutTabs, cutPolys } = state;
let { process, stock } = settings;
let toolDiam = this.toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
updateToolDiams(toolDiam);
@ -497,6 +504,11 @@
CAM.addDogbones(offset, toolDiam / 5);
}
if (process.camStockClipTo) {
let rect = newPolygon().centerRectangle(stock.center, stock.x, stock.y);
offset = cutPolys([rect], offset, slice.z, true);
}
// offset.xout(`slice ${slice.z}`);
slice.camLines = offset;
if (false) slice.output()