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