fix spindle in drill. add 'clear' mode to trace op
This commit is contained in:
parent
01bdeda218
commit
6a18577dbc
6 changed files with 48 additions and 32 deletions
|
|
@ -443,7 +443,9 @@
|
|||
camContourXOn: true,
|
||||
camContourYOn: true,
|
||||
camTraceTool: 1000,
|
||||
camTraceSpindle: 1000,
|
||||
camTraceType: "follow",
|
||||
camTraceOver: 0.5,
|
||||
camTraceSpeed: 250,
|
||||
camTracePlunge: 200,
|
||||
camDrillTool: 1000,
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@
|
|||
],
|
||||
trace: [
|
||||
{ name: "follow" },
|
||||
{ name: "clear" }
|
||||
// { name: "out" },
|
||||
// { name: "in" }
|
||||
],
|
||||
|
|
|
|||
|
|
@ -741,14 +741,18 @@
|
|||
};
|
||||
|
||||
createPopOp('trace', {
|
||||
mode: 'camTraceType',
|
||||
tool: 'camTraceTool',
|
||||
rate: 'camTraceSpeed',
|
||||
plunge: 'camTracePlunge'
|
||||
mode: 'camTraceType',
|
||||
spindle: 'camTraceSpindle',
|
||||
tool: 'camTraceTool',
|
||||
step: 'camTraceOver',
|
||||
rate: 'camTraceSpeed',
|
||||
plunge: 'camTracePlunge'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
mode: UC.newSelect(LANG.cu_type_s, {title:LANG.cu_type_l}, "trace"),
|
||||
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
||||
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"}),
|
||||
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
||||
plunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, units:true}),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
|
|
|
|||
|
|
@ -9,17 +9,7 @@
|
|||
POLY = BASE.polygons,
|
||||
UTIL = BASE.util,
|
||||
CAM = KIRI.driver.CAM,
|
||||
PRO = CAM.process,
|
||||
MODES = [
|
||||
"unset",
|
||||
"level",
|
||||
"rough",
|
||||
"outline",
|
||||
"contour-x",
|
||||
"contour-y",
|
||||
"trace",
|
||||
"drill"
|
||||
];
|
||||
PRO = CAM.process;
|
||||
|
||||
/**
|
||||
* @returns {Array} gcode lines
|
||||
|
|
@ -53,7 +43,7 @@
|
|||
pos = { x:null, y:null, z:null, f:null, t:null },
|
||||
line,
|
||||
cidx,
|
||||
mode = 0,
|
||||
mode,
|
||||
point,
|
||||
points = 0,
|
||||
stock = settings.stock,
|
||||
|
|
@ -282,9 +272,9 @@
|
|||
// emit all points in layer/point order
|
||||
print.output.forEach(function (layerout) {
|
||||
if (mode !== layerout.mode) {
|
||||
if (mode && !stripComments) append("; ending " + MODES[mode] + " pass after " + Math.round(time/60) + " seconds");
|
||||
if (mode && !stripComments) append("; ending " + mode + " op after " + Math.round(time/60) + " seconds");
|
||||
mode = layerout.mode;
|
||||
if (!stripComments) append("; starting " + MODES[mode] + " pass");
|
||||
if (!stripComments) append("; starting " + mode + " op");
|
||||
}
|
||||
if (layerout.spindle && layerout.spindle !== spindle) {
|
||||
spindle = layerout.spindle;
|
||||
|
|
@ -299,7 +289,7 @@
|
|||
moveTo(out);
|
||||
});
|
||||
});
|
||||
if (mode && !stripComments) append("; ending " + MODES[mode] + " pass after " + Math.round(time/60) + " seconds");
|
||||
if (mode && !stripComments) append("; ending " + mode + " op after " + Math.round(time/60) + " seconds");
|
||||
|
||||
// emit gcode post
|
||||
filterEmit(gcodes.gcodePost, consts);
|
||||
|
|
|
|||
|
|
@ -665,26 +665,40 @@
|
|||
// generate tracing offsets from chosen features
|
||||
let sliceOut = this.sliceOut = [];
|
||||
let areas = op.areas[widget.id] || [];
|
||||
let traceTool = new CAM.Tool(settings, tool);
|
||||
let traceToolDiam = traceTool.fluteDiameter();
|
||||
let toolDiam = new CAM.Tool(settings, tool).fluteDiameter();
|
||||
let toolOver = toolDiam * op.step;
|
||||
let cutdir = process.camConventional;
|
||||
updateToolDiams(traceToolDiam);
|
||||
updateToolDiams(toolDiam);
|
||||
areas.forEach(arr => {
|
||||
let slice = newSlice();
|
||||
let poly = newPolygon().fromArray(arr);
|
||||
POLY.setWinding([ poly ], cutdir, false);
|
||||
slice.addTop(poly);
|
||||
slice.camLines = [ poly ];
|
||||
slice.camTrace = { tool, rate, plunge };
|
||||
slice.camLines = [ poly ];
|
||||
switch (op.mode) {
|
||||
case "follow":
|
||||
break;
|
||||
case "clear":
|
||||
POLY.offset([poly], -toolOver, {
|
||||
count:999, outs: slice.camLines, flat:true, z: poly.getZ()
|
||||
});
|
||||
break;
|
||||
}
|
||||
sliceAll.push(slice);
|
||||
sliceOut.push(slice);
|
||||
if (true) slice.output()
|
||||
.setLayer("trace", {line: 0xaa00aa}, false)
|
||||
.addPolys(slice.camLines)
|
||||
sliceAll.push(slice);
|
||||
sliceOut.push(slice);
|
||||
});
|
||||
}
|
||||
|
||||
prepare(ops, progress) {
|
||||
let { op, state } = this;
|
||||
let { settings } = state;
|
||||
let { setTool, setSpindle } = ops;
|
||||
|
||||
setTool(op.tool, op.rate);
|
||||
setSpindle(op.spindle);
|
||||
for (let slice of this.sliceOut) {
|
||||
ops.emitTrace(slice);
|
||||
}
|
||||
|
|
@ -757,10 +771,11 @@
|
|||
prepare(ops, progress) {
|
||||
let { op, state } = this;
|
||||
let { settings, widget, sliceAll, tslices, updateToolDiams } = state;
|
||||
let { setTool, setDrill, emitDrills } = ops;
|
||||
let { setTool, setSpindle, setDrill, emitDrills } = ops;
|
||||
|
||||
setTool(op.tool, op.down, op.rate);
|
||||
setTool(op.tool, op.rate, op.down);
|
||||
setDrill(op.down, op.lift, op.dwell);
|
||||
setSpindle(op.spindle);
|
||||
emitDrills(this.sliceOut.map(slice => slice.camLines).flat());
|
||||
}
|
||||
}
|
||||
|
|
@ -833,10 +848,11 @@
|
|||
prepare(ops, progress) {
|
||||
let { op, state } = this;
|
||||
let { settings, widget, sliceAll, tslices, updateToolDiams } = state;
|
||||
let { setTool, setDrill, emitDrills } = ops;
|
||||
let { setTool, setSpindle, setDrill, emitDrills } = ops;
|
||||
|
||||
setTool(op.tool, op.down, op.rate);
|
||||
setTool(op.tool, op.rate, op.down);
|
||||
setDrill(op.down, op.lift, op.dwell);
|
||||
setSpindle(op.spindle);
|
||||
emitDrills(this.sliceOut.map(slice => slice.camLines).flat());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
}
|
||||
newOutput.push(layerOut);
|
||||
layerOut = [];
|
||||
layerOut.mode = lastMode;
|
||||
layerOut.spindle = spindle;
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +141,8 @@
|
|||
toolDiamMove = toolType === 'endmill' ? toolDiam : tolerance * 2;
|
||||
lastTool = toolID;
|
||||
}
|
||||
feedRate = feed;
|
||||
plungeRate = plunge;
|
||||
feedRate = feed || feedRate;
|
||||
plungeRate = plunge || plungeRate;
|
||||
}
|
||||
|
||||
function setDrill(down, lift, dwell) {
|
||||
|
|
@ -324,6 +325,7 @@
|
|||
}
|
||||
|
||||
// todo synthesize move speed from feed / plunge accordingly
|
||||
layerOut.mode = lastMode;
|
||||
layerOut.spindle = spindle;
|
||||
lastPoint = layerPush(
|
||||
point,
|
||||
|
|
@ -379,6 +381,7 @@
|
|||
for (let op of widget.camops) {
|
||||
setTolerance(0);
|
||||
nextIsMove = true;
|
||||
lastMode = op.op.type;
|
||||
let weight = op.weight();
|
||||
op.prepare(ops, (progress, message) => {
|
||||
onupdate((opSum + (progress * weight)) / opTot, message || op.type());
|
||||
|
|
|
|||
Loading…
Reference in a new issue