add trace support for taper tip diameter and offset override
This commit is contained in:
parent
14226a19cb
commit
0dc3f190e4
7 changed files with 24 additions and 6 deletions
|
|
@ -1313,6 +1313,7 @@ CAM.init = function(kiri, api) {
|
|||
rate: 'camTraceSpeed',
|
||||
plunge: 'camTracePlunge',
|
||||
bottom: 'camTraceBottom',
|
||||
offover: 'camTraceOffOver',
|
||||
select: 'camTraceMode'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
|
|
@ -1327,6 +1328,7 @@ CAM.init = function(kiri, api) {
|
|||
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), show:(op) => popOp.trace.rec.mode === "clear"}),
|
||||
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true}),
|
||||
thru: UC.newInput(LANG.cc_thru_s, {title:LANG.cc_thru_l, convert:UC.toFloat, units:true}),
|
||||
offover: UC.newInput(LANG.cc_offd_s, {title:LANG.cc_offd_l, convert:UC.toFloat, units:true, show:() => poppedRec.offset !== "none"}),
|
||||
sep: UC.newBlank({class:"pop-sep", modes:MCAM, show:zBottom, poop:true }),
|
||||
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf.process.camZBottom}),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ class OpTrace extends CamOp {
|
|||
|
||||
async slice(progress) {
|
||||
let { op, state } = this;
|
||||
let { tool, rate, down, plunge, offset, thru } = op;
|
||||
let { tool, rate, down, plunge, offset, offover, thru } = op;
|
||||
let { settings, widget, addSlices, zMax, zTop, zThru, tabs } = state;
|
||||
let { updateToolDiams, cutTabs, cutPolys, healPolys, color } = state;
|
||||
let { process, stock } = settings;
|
||||
|
|
@ -848,8 +848,10 @@ class OpTrace extends CamOp {
|
|||
// generate tracing offsets from chosen features
|
||||
let sliceOut = this.sliceOut = [];
|
||||
let areas = op.areas[widget.id] || [];
|
||||
let toolDiam = new CAM.Tool(settings, tool).fluteDiameter();
|
||||
let camTool = new CAM.Tool(settings, tool);
|
||||
let toolDiam = camTool.fluteDiameter();
|
||||
let toolOver = toolDiam * op.step;
|
||||
let traceOffset = camTool.traceOffset()
|
||||
let cutdir = process.camConventional;
|
||||
let polys = [];
|
||||
let stockRect = stock.center && stock.x && stock.y ?
|
||||
|
|
@ -975,11 +977,13 @@ class OpTrace extends CamOp {
|
|||
routed.push(poly);
|
||||
});
|
||||
for (let poly of POLY.nest(routed)) {
|
||||
let offdist = 0;
|
||||
let offdist = offover;
|
||||
if (!offdist)
|
||||
switch (offset) {
|
||||
case "outside": offdist = toolDiam / 2; break;
|
||||
case "inside": offdist = -toolDiam / 2; break;
|
||||
case "outside": offdist = traceOffset; break;
|
||||
case "inside": offdist = -traceOffset; break;
|
||||
}
|
||||
console.log({ offdist });
|
||||
if (offdist) {
|
||||
let pnew = POLY.offset([poly], offdist, { minArea: 0 });
|
||||
if (pnew) {
|
||||
|
|
@ -1000,6 +1004,9 @@ class OpTrace extends CamOp {
|
|||
followZ(pi.clone().setZ(z));
|
||||
}
|
||||
} else {
|
||||
if (thru) {
|
||||
pi.setZ(pi.getZ() - thru);
|
||||
}
|
||||
followZ(pi);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ class Tool {
|
|||
return this.unitScale() * this.tool.taper_tip;
|
||||
}
|
||||
|
||||
traceOffset() {
|
||||
return (this.isTaperMill() ? this.tipDiameter() : this.fluteDiameter()) / 2;
|
||||
}
|
||||
|
||||
shaftLength() {
|
||||
return this.unitScale() * this.tool.shaft_len;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue