improve path moves in indexed mode

This commit is contained in:
Stewart Allen 2023-02-15 13:30:48 -05:00
commit 3e36f2f9ea
4 changed files with 15 additions and 9 deletions

View file

@ -1352,7 +1352,7 @@ CAM.init = function(kiri, api) {
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,10.0)}),
angle: UC.newInput(LANG.cc_sang_s, {title:LANG.cc_sang_l, convert:UC.toFloat, bound:UC.bound(0.01,10.0)}),
angle: UC.newInput(LANG.cc_sang_s, {title:LANG.cc_sang_l, convert:UC.toFloat, bound:UC.bound(0.01,90.0)}),
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4}),
};

View file

@ -169,7 +169,7 @@ class OpRough extends CamOp {
let { op, state } = this;
let { settings, widget, slicer, addSlices, unsafe, color } = state;
let { updateToolDiams, thruHoles, tabs, cutTabs, cutPolys } = state;
let { tshadow, shadowTop, ztOff, zBottom, zMax, shadowAt } = state;
let { tshadow, shadowTop, ztOff, zBottom, zMax, shadowAt, isIndexed } = state;
let { process, stock } = settings;
if (op.down <= 0) {
@ -180,7 +180,7 @@ class OpRough extends CamOp {
let roughTop = op.top;
let roughDown = op.down;
let roughLeave = op.leave;
let roughStock = op.all && state.isIndexed;
let roughStock = op.all && isIndexed;
let toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
let trueShadow = process.camTrueShadow === true;
@ -188,11 +188,15 @@ class OpRough extends CamOp {
if (roughTop) {
let shadow = tshadow.clone();
let step = toolDiam * op.step;
let inset = POLY.offset(shadow, roughIn ? step : step + roughLeave + toolDiam / 2);
let inset = roughStock ?
POLY.offset([ newPolygon().centerRectangle(stock.center, stock.x, stock.y) ], step) :
POLY.offset(shadow, roughIn ? step : step + roughLeave + toolDiam / 2);
let facing = POLY.offset(inset, -step, { count: 999, flat: true });
let zdiv = ztOff / roughDown;
let zstep = (zdiv % 1 > 0) ? ztOff / (Math.floor(zdiv) + 1) : roughDown;
if (ztOff === 0) {
if (isIndexed) {
ztOff = (stock.z / 2) - zMax;
} else if (ztOff === 0) {
// compensate for lack of z top offset in this scenario
ztOff = zstep;
}
@ -308,7 +312,7 @@ class OpRough extends CamOp {
// shell = shadow expanded by half tool diameter + leave stock
const sadd = roughIn ? toolDiam / 2 : toolDiam / 2;
const shell = roughStock ?
[ newPolygon().centerRectangle(stock.center, stock.x, stock.y) ] :
POLY.offset([ newPolygon().centerRectangle(stock.center, stock.x, stock.y) ], sadd) :
POLY.offset(shadow, sadd + roughLeave);
slices.forEach((slice, index) => {

View file

@ -107,6 +107,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
plungeRate = process.camFastFeedZ,
feedRate,
lastTool,
lastPush,
lastPoint,
currentOp,
nextIsMove = true,
@ -279,6 +280,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
} else {
print.addOutput(layerOut, point, emit, speed, tool);
}
lastPush = { point, emit, speed, tool };
return point;
}
@ -378,7 +380,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
}
// up if any point between higher than start/outline, go up first
if (mustGoUp || zIsBelow) {
const zClearance = clearz + ztOff;
const zClearance = clearz + (isIndexed ? 0 : ztOff);
if (zIsBelow) {
layerPush(lastPoint.clone().setZ(zClearance), 0, 0, tool.getNumber());
}
@ -470,7 +472,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
opSum += weight;
if (tool) {
newLayer();
camOut(printPoint = printPoint.clone().setZ(zmax + zadd + ztOff));
camOut(printPoint = lastPoint.clone().setZ(zmax + zadd));
newLayer();
}
}

View file

@ -470,7 +470,7 @@ const conf = exports({
camRoughSpeed: 1000,
camRoughPlunge: 250,
camRoughStock: 0,
camRoughAll: false,
camRoughAll: true,
camRoughVoid: false,
camRoughFlat: true,
camRoughTop: true,