Merge branch 'master' into cam-topo4

This commit is contained in:
Stewart Allen 2023-01-17 19:11:30 -05:00
commit c6d13a64b2
8 changed files with 37 additions and 8 deletions

View file

@ -25,6 +25,8 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* CAM update traces to async slicing, fix use with flip * CAM update traces to async slicing, fix use with flip
* CAM add threading support for all slicing ops * CAM add threading support for all slicing ops
* CAM add omit pocket option to outline op * CAM add omit pocket option to outline op
* CAM add trace support for taper tip diameter
* CAM add trace offset override
# Release 3.7 (2022-11-12) # Release 3.7 (2022-11-12)

View file

@ -1349,6 +1349,7 @@ CAM.init = function(kiri, api) {
rate: 'camTraceSpeed', rate: 'camTraceSpeed',
plunge: 'camTracePlunge', plunge: 'camTracePlunge',
bottom: 'camTraceBottom', bottom: 'camTraceBottom',
offover: 'camTraceOffOver',
select: 'camTraceMode' select: 'camTraceMode'
}).inputs = { }).inputs = {
tool: UC.newSelect(LANG.cc_tool, {}, "tools"), tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
@ -1363,6 +1364,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"}), 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}), 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}), 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 }), 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}), 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"}), sep: UC.newBlank({class:"pop-sep"}),

View file

@ -47,14 +47,16 @@ CAM.export = function(print, online) {
spro = settings.process, spro = settings.process,
maxZd = spro.camFastFeedZ, maxZd = spro.camFastFeedZ,
maxXYd = spro.camFastFeed, maxXYd = spro.camFastFeed,
decimals = base.config.gcode_decimals || 4, decimals = base.config.gcode_decimals || 3,
pos = { x:null, y:null, z:null, a:undefined, f:null, t:null, emit:null }, pos = { x:null, y:null, z:null, a:undefined, f:null, t:null, emit:null },
line, line,
cidx, cidx,
mode, mode,
point, point,
points = 0, points = 0,
lastGn = '',
rewrite_comments = false, rewrite_comments = false,
compact_output = false,
lasering = false, lasering = false,
laserOp, laserOp,
stock = settings.stock || { }, stock = settings.stock || { },
@ -249,7 +251,8 @@ CAM.export = function(print, online) {
} }
let speed = out.speed, let speed = out.speed,
nl = [speed ? 'G1' : 'G0'], gn = speed ? 'G1' : 'G0',
nl = (compact_output && lastGn === gn) ? [] : [gn],
dx = opt.dx || newpos.x - pos.x, dx = opt.dx || newpos.x - pos.x,
dy = opt.dy || newpos.y - pos.y, dy = opt.dy || newpos.y - pos.y,
dz = opt.dz || newpos.z - pos.z, dz = opt.dz || newpos.z - pos.z,
@ -263,6 +266,8 @@ CAM.export = function(print, online) {
return; return;
} }
lastGn = gn;
if (dx || newpos.x !== pos.x) { if (dx || newpos.x !== pos.x) {
pos.x = newpos.x; pos.x = newpos.x;
runbox.min.x = Math.min(runbox.min.x, pos.x); runbox.min.x = Math.min(runbox.min.x, pos.x);
@ -351,6 +356,12 @@ CAM.export = function(print, online) {
} }
} else if (line.indexOf(';; REWRITE-COMMENTS-PARENS') === 0) { } else if (line.indexOf(';; REWRITE-COMMENTS-PARENS') === 0) {
rewrite_comments = true; rewrite_comments = true;
} else if (line.indexOf(';; DECMIALS') === 0) {
decimals = parseInt(line.split('=')[1].trim() || 3) || 3;
} else if (line.indexOf(';; COMPACT-OUTPUT') === 0) {
compact_output = true;
stripComments = true;
space = '';
} else { } else {
gcodePre.push(line); gcodePre.push(line);
} }

View file

@ -909,7 +909,7 @@ class OpTrace extends CamOp {
async slice(progress) { async slice(progress) {
let { op, state } = this; 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 { settings, widget, addSlices, zMax, zTop, zThru, tabs } = state;
let { updateToolDiams, cutTabs, cutPolys, healPolys, color } = state; let { updateToolDiams, cutTabs, cutPolys, healPolys, color } = state;
let { process, stock } = settings; let { process, stock } = settings;
@ -920,8 +920,10 @@ class OpTrace extends CamOp {
// generate tracing offsets from chosen features // generate tracing offsets from chosen features
let sliceOut = this.sliceOut = []; let sliceOut = this.sliceOut = [];
let areas = op.areas[widget.id] || []; 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 toolOver = toolDiam * op.step;
let traceOffset = camTool.traceOffset()
let cutdir = process.camConventional; let cutdir = process.camConventional;
let polys = []; let polys = [];
let stockRect = stock.center && stock.x && stock.y ? let stockRect = stock.center && stock.x && stock.y ?
@ -1047,11 +1049,13 @@ class OpTrace extends CamOp {
routed.push(poly); routed.push(poly);
}); });
for (let poly of POLY.nest(routed)) { for (let poly of POLY.nest(routed)) {
let offdist = 0; let offdist = offover;
if (!offdist)
switch (offset) { switch (offset) {
case "outside": offdist = toolDiam / 2; break; case "outside": offdist = traceOffset; break;
case "inside": offdist = -toolDiam / 2; break; case "inside": offdist = -traceOffset; break;
} }
console.log({ offdist });
if (offdist) { if (offdist) {
let pnew = POLY.offset([poly], offdist, { minArea: 0 }); let pnew = POLY.offset([poly], offdist, { minArea: 0 });
if (pnew) { if (pnew) {
@ -1072,6 +1076,9 @@ class OpTrace extends CamOp {
followZ(pi.clone().setZ(z)); followZ(pi.clone().setZ(z));
} }
} else { } else {
if (thru) {
pi.setZ(pi.getZ() - thru);
}
followZ(pi); followZ(pi);
} }
} }

View file

@ -61,6 +61,10 @@ class Tool {
return this.unitScale() * this.tool.taper_tip; return this.unitScale() * this.tool.taper_tip;
} }
traceOffset() {
return (this.isTaperMill() ? this.tipDiameter() : this.fluteDiameter()) / 2;
}
shaftLength() { shaftLength() {
return this.unitScale() * this.tool.shaft_len; return this.unitScale() * this.tool.shaft_len;
} }

View file

@ -511,6 +511,7 @@ const conf = exports({
camTraceThru: 0, camTraceThru: 0,
camTraceSpeed: 250, camTraceSpeed: 250,
camTracePlunge: 200, camTracePlunge: 200,
camTraceOffOver: 0,
camTraceLines: false, camTraceLines: false,
camTraceBottom: false, camTraceBottom: false,
camPocketSpindle: 1000, camPocketSpindle: 1000,

View file

@ -92,7 +92,7 @@ const LISTS = {
{ name: "clear" } { name: "clear" }
], ],
traceoff: [ traceoff: [
{ name: "center" }, { name: "none" },
{ name: "inside" }, { name: "inside" },
{ name: "outside" } { name: "outside" }
], ],

View file

@ -448,6 +448,8 @@ self.kiri.lang['en-us'] = {
cc_sdwn_l: ["step down depth","for each pass","in workspace units","0 to disable"], cc_sdwn_l: ["step down depth","for each pass","in workspace units","0 to disable"],
cc_thru_s: "cut thru", cc_thru_s: "cut thru",
cc_thru_l: ["additional cut depth below trace bottom"], cc_thru_l: ["additional cut depth below trace bottom"],
cc_offd_s: "offset",
cc_offd_l: ["overrides default offset distance (which is the tool radius) when set to any value but zero"],
cc_feed_s: "feed rate", cc_feed_s: "feed rate",
cc_feed_l: ["max cutting speed in","workspace units / minute"], cc_feed_l: ["max cutting speed in","workspace units / minute"],
cc_plng_s: "plunge rate", cc_plng_s: "plunge rate",