rm dead code. step over in outlining when wide cutout enabled. fix imperial units in cam op hover tip
This commit is contained in:
parent
2647d17d65
commit
f7624844d0
7 changed files with 36 additions and 240 deletions
|
|
@ -411,7 +411,7 @@
|
|||
camRoughTool: 1000,
|
||||
camRoughSpindle: 1000,
|
||||
camRoughDown: 2,
|
||||
camRoughOver: 0.5,
|
||||
camRoughOver: 0.4,
|
||||
camRoughSpeed: 1000,
|
||||
camRoughPlunge: 250,
|
||||
camRoughStock: 0,
|
||||
|
|
@ -423,6 +423,7 @@
|
|||
camOutlineTool: 1000,
|
||||
camOutlineSpindle: 1000,
|
||||
camOutlineDown: 3,
|
||||
camOutlineOver: 0.4,
|
||||
camOutlineSpeed: 800,
|
||||
camOutlinePlunge: 250,
|
||||
camOutlineWide: false,
|
||||
|
|
|
|||
|
|
@ -1630,8 +1630,8 @@
|
|||
camRoughTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
||||
camSep: UC.newBlank({class:"pop-sep"}),
|
||||
camRoughSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||
camRoughOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), modes:CAM}),
|
||||
camRoughDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||
camRoughOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), modes:CAM}),
|
||||
camRoughSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||
camRoughPlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||
camRoughStock: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||
|
|
@ -1651,6 +1651,7 @@
|
|||
camSep: UC.newBlank({class:"pop-sep"}),
|
||||
camOutlineSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||
camOutlineDown: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, modes:CAM, units:true}),
|
||||
camOutlineOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, modes:CAM, bound:UC.bound(0.01,1.0), units:true, show:() => { return UI.camOutlineWide.checked }}),
|
||||
camOutlineSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||
camOutlinePlunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||
camSep: UC.newBlank({class:"pop-sep"}),
|
||||
|
|
@ -1668,7 +1669,7 @@
|
|||
camContourTool: UC.newSelect(LANG.cc_tool, {modes:CAM}),
|
||||
camSep: UC.newBlank({class:"pop-sep"}),
|
||||
camContourSpindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, modes:CAM, visible:spindleShow}),
|
||||
camContourOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.05,1.0), modes:CAM}),
|
||||
camContourOver: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), modes:CAM}),
|
||||
camContourSpeed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, modes:CAM, units:true}),
|
||||
camContourAngle: UC.newInput(LANG.cf_angl_s, {title:LANG.cf_angl_l, convert:UC.toFloat, bound:UC.bound(45,90), modes:CAM}),
|
||||
camTolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), modes:CAM, units:true}),
|
||||
|
|
@ -2347,7 +2348,7 @@
|
|||
UI.acct.export.onclick = (ev) => { ev.stopPropagation(); profileExport() };
|
||||
UI.acct.export.title = LANG.acct_xpo;
|
||||
$('file-recent').onclick = () => { API.modal.show('files') };
|
||||
$('file-import').onclick = () => { API.event.import() };
|
||||
$('file-import').onclick = (ev) => { API.event.import(ev) };
|
||||
UI.back.onclick = API.platform.layout;
|
||||
UI.trash.onclick = API.selection.delete;
|
||||
UI.func.slice.onclick = (ev) => { ev.stopPropagation(); API.function.slice() };
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@
|
|||
type: "outline",
|
||||
tool: process.camOutlineTool,
|
||||
spindle: process.camOutlineSpindle,
|
||||
step: process.camOutlineOver,
|
||||
down: process.camOutlineDown,
|
||||
rate: process.camOutlineSpeed,
|
||||
plunge: process.camOutlinePlunge,
|
||||
|
|
@ -303,13 +304,32 @@
|
|||
type: "use right menu to add milling operations ... drag & drop to re-order"
|
||||
}];
|
||||
let bind = {};
|
||||
let scale = API.view.unit_scale();
|
||||
oplist.forEach((rec,i) => {
|
||||
let entries = 0;
|
||||
let title = Object.entries(rec).filter((v,i) => {
|
||||
return v[0] !== 'type'
|
||||
}).map(v => v.join(": ")).join("\n");
|
||||
}).map(v => {
|
||||
entries++;
|
||||
let [ key, value ] = v;
|
||||
switch (key) {
|
||||
case 'tool':
|
||||
value = new CAM.Tool(current, v[1]).getName();
|
||||
break;
|
||||
case 'down':
|
||||
case 'rate':
|
||||
case 'plunge':
|
||||
case 'leave':
|
||||
case 'lift':
|
||||
value = (parseFloat(v[1]) / scale).round(2);
|
||||
break;
|
||||
}
|
||||
return `<tr><th>${key}</th><td>${value}</td></tr>`;
|
||||
}).join("\n");
|
||||
title = `<table>${title}</table>`;
|
||||
html.appendAll([
|
||||
`<div id="${mark+i}">`,
|
||||
title.length ? `<div class="opop">${title}</div>` : '',
|
||||
entries ? `<div class="opop">${title}</div>` : '',
|
||||
`<label class="label">${rec.type}</label>`,
|
||||
`<label id="${mark+i}-x" class="del"><i class="fas fa-times"></i></label>`,
|
||||
`</div>`
|
||||
|
|
|
|||
|
|
@ -406,10 +406,11 @@
|
|||
});
|
||||
} else {
|
||||
if (op.wide) {
|
||||
let stepover = outlineToolDiam * op.step;
|
||||
offset.slice().forEach(op => {
|
||||
// clone removes inners but the real solution is
|
||||
// to limit expanded shells to through holes
|
||||
POLY.expand([op.clone(true)], outlineToolDiam * 0.5, slice.z, offset, 1);
|
||||
POLY.expand([op.clone(true)], stepover, slice.z, offset, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@
|
|||
|
||||
function prepEach(widget, settings, print, firstPoint, update) {
|
||||
|
||||
if (widget.camops.length === 0) return;
|
||||
|
||||
let device = settings.device,
|
||||
process = settings.process,
|
||||
stock = settings.stock,
|
||||
|
|
@ -87,8 +89,8 @@
|
|||
toolType,
|
||||
toolDiam,
|
||||
toolDiamMove,
|
||||
feedRate,
|
||||
plungeRate,
|
||||
feedRate,
|
||||
lastTool,
|
||||
lastMode,
|
||||
lastPoint,
|
||||
|
|
@ -169,10 +171,6 @@
|
|||
printPoint = closest.first();
|
||||
emitDrill(closest, drillDown, drillLift, drillDwell);
|
||||
}
|
||||
// TODO emit in next-closest-order
|
||||
// polys.forEach(function(poly) {
|
||||
// emitDrill(poly, drillDown, drillLift, drillDwell);
|
||||
// });
|
||||
}
|
||||
|
||||
function emitDrill(poly, down, lift, dwell) {
|
||||
|
|
@ -387,125 +385,6 @@
|
|||
opSum += weight;
|
||||
}
|
||||
|
||||
// todo first move into positon
|
||||
if (false) slices.forEach(function(slice, sliceIndex) {
|
||||
depthData.layer++;
|
||||
isNewMode = slice.camMode != lastMode;
|
||||
lastMode = slice.camMode;
|
||||
// force move at start of each slice
|
||||
nextIsMove = true;
|
||||
if (isNewMode) depthData.layer = 0;
|
||||
|
||||
switch (slice.camMode) {
|
||||
case PRO.LEVEL:
|
||||
setTool(process.camRoughTool, process.camRoughSpeed, process.camRoughPlunge);
|
||||
spindle = Math.min(spindleMax, process.camRoughSpindle);
|
||||
const level = [];
|
||||
slice.camLines.forEach(function (poly) {
|
||||
level.push(poly);
|
||||
if (poly.inner) {
|
||||
poly.inner.forEach(function(inner) {
|
||||
level.push(inner);
|
||||
})
|
||||
}
|
||||
});
|
||||
// set winding specified in output
|
||||
POLY.setWinding(level, process.camConventional, false);
|
||||
printPoint = poly2polyEmit(level, printPoint, function(poly, index, count) {
|
||||
poly.forEachPoint(function(point, pidx, points, offset) {
|
||||
camOut(point.clone(), offset !== 0);
|
||||
}, true, index);
|
||||
});
|
||||
newLayer();
|
||||
break;
|
||||
case PRO.ROUGH:
|
||||
case PRO.OUTLINE:
|
||||
let dir = process.camConventional;
|
||||
if (slice.camMode === PRO.ROUGH) {
|
||||
setTool(process.camRoughTool, process.camRoughSpeed, process.camRoughPlunge);
|
||||
spindle = Math.min(spindleMax, process.camRoughSpindle);
|
||||
depthData.roughDiam = toolDiam;
|
||||
} else {
|
||||
setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
|
||||
spindle = Math.min(spindleMax, process.camOutlineSpindle);
|
||||
depthData.outlineDiam = toolDiam;
|
||||
if (!process.camOutlinePocket) {
|
||||
dir = !dir;
|
||||
}
|
||||
}
|
||||
let polys = [], t = [], c = [];
|
||||
POLY.flatten(slice.camLines).forEach(function (poly) {
|
||||
let child = poly.parent;
|
||||
if (depthFirst) { poly = poly.clone(); poly.parent = child ? 1 : 0 }
|
||||
if (child) c.push(poly); else t.push(poly);
|
||||
poly.layer = depthData.layer;
|
||||
polys.push(poly);
|
||||
});
|
||||
// set cut direction on outer polys
|
||||
POLY.setWinding(t, dir);
|
||||
// set cut direction on inner polys
|
||||
POLY.setWinding(c, !dir);
|
||||
if (depthFirst) {
|
||||
(slice.camMode === PRO.ROUGH ? depthData.rough : depthData.outline).append(polys);
|
||||
// polys.xout(`prep ${slice.z}`);
|
||||
} else {
|
||||
printPoint = poly2polyEmit(polys, printPoint, function(poly, index, count) {
|
||||
poly.forEachPoint(function(point, pidx, points, offset) {
|
||||
camOut(point.clone(), offset !== 0);
|
||||
}, poly.isClosed(), index);
|
||||
});
|
||||
newLayer();
|
||||
}
|
||||
break;
|
||||
case PRO.CONTOUR_X:
|
||||
case PRO.CONTOUR_Y:
|
||||
if (isNewMode || !printPoint) {
|
||||
// force start at lower left corner
|
||||
printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
|
||||
}
|
||||
setTool(process.camContourTool, process.camContourSpeed, process.camFastFeedZ);
|
||||
spindle = Math.min(spindleMax, process.camContourSpindle);
|
||||
depthData.outlineDiam = toolDiam;
|
||||
// todo find closest next trace/trace-point
|
||||
{
|
||||
let polys = [], poly, emit;
|
||||
slice.camLines.forEach(function (poly) {
|
||||
if (depthFirst) poly = poly.clone(true);
|
||||
polys.push({first:poly.first(), last:poly.last(), poly:poly});
|
||||
});
|
||||
if (depthFirst) {
|
||||
(slice.camMode === PRO.CONTOUR_X ? depthData.contourx : depthData.contoury).appendAll(polys);
|
||||
} else {
|
||||
printPoint = tip2tipEmit(polys, printPoint, function(el, point, count) {
|
||||
poly = el.poly;
|
||||
if (poly.last() === point) {
|
||||
poly.reverse();
|
||||
}
|
||||
poly.forEachPoint(function(point, pidx) {
|
||||
camOut(point.clone(), pidx > 0);
|
||||
}, false);
|
||||
// return lastPoint;
|
||||
});
|
||||
newLayer();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PRO.TRACE:
|
||||
if (depthFirst) {
|
||||
depthData.trace.push(slice);
|
||||
break;
|
||||
} else {
|
||||
emitTrace(slice);
|
||||
}
|
||||
break;
|
||||
case PRO.DRILL:
|
||||
setTool(process.camDrillTool, process.camDrillDownSpeed, process.camDrillDownSpeed);
|
||||
depthData.drill.appendAll(slice.camLines);
|
||||
break;
|
||||
}
|
||||
update(sliceIndex / slices.length);
|
||||
});
|
||||
|
||||
function emitTrace(slice) {
|
||||
let { tool, speed, plunge, path } = slice.camTrace;
|
||||
setTool(tool, speed, plunge);
|
||||
|
|
@ -586,99 +465,6 @@
|
|||
return start;
|
||||
}
|
||||
|
||||
// act on accumulated layer data
|
||||
if (false && depthFirst) {
|
||||
// roughing depth first
|
||||
if (depthData.rough.length > 0) {
|
||||
lastMode = PRO.ROUGH;
|
||||
setTool(process.camRoughTool, process.camRoughSpeed, process.camRoughPlunge);
|
||||
spindle = Math.min(spindleMax, process.camRoughSpindle);
|
||||
let tops = depthData.rough.map(level => {
|
||||
return POLY.nest(level.filter(poly => poly.depth === 0).clone());
|
||||
});
|
||||
printPoint = depthRoughPath(printPoint, 0, depthData.rough, tops, polyEmit);
|
||||
}
|
||||
// outline depth first
|
||||
if (depthData.outline.length > 0) {
|
||||
// depthData.outline.xout('depth');
|
||||
lastMode = PRO.OUTLINE;
|
||||
setTool(process.camOutlineTool, process.camOutlineSpeed, process.camOutlinePlunge);
|
||||
spindle = Math.min(spindleMax, process.camOutlineSpindle);
|
||||
let flatLevels = depthData.outline.map(level => {
|
||||
return POLY.flatten(level.clone(true), [], true).filter(p => !(p.depth = 0));
|
||||
}).filter(l => l.length > 0);
|
||||
// flatLevels.xout('flat');
|
||||
// start with the smallest polygon on the top
|
||||
printPoint = flatLevels[0]
|
||||
// .filter(l => l.length > 0)[0]
|
||||
.sort((a,b) => { return a.area() - b.area() })[0]
|
||||
.average();
|
||||
printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, false);
|
||||
printPoint = depthOutlinePath(printPoint, 0, flatLevels, toolDiam, polyEmit, true);
|
||||
}
|
||||
// two modes for deferred outlining: x then y or combined
|
||||
if (contour && contourCurves) {
|
||||
lastMode = PRO.CONTOUR_X;
|
||||
setTool(process.camContourTool, process.camContourSpeed, process.camContourPlunge);
|
||||
spindle = Math.min(spindleMax, process.camContourSpindle);
|
||||
// combined deferred contour x and y outlining
|
||||
let contourxy = [].appendAll(depthData.contourx).appendAll(depthData.contoury);
|
||||
printPoint = tip2tipEmit(contourxy, printPoint, function(el, point, count) {
|
||||
let poly = el.poly;
|
||||
if (poly.last() === point) {
|
||||
poly.reverse();
|
||||
}
|
||||
poly.forEachPoint(function(point, pidx) {
|
||||
camOut(point.clone(), pidx > 0);
|
||||
}, false);
|
||||
newLayer();
|
||||
return lastPoint;
|
||||
});
|
||||
} else if (contour) {
|
||||
setTool(process.camContourTool, process.camContourSpeed, process.camContourPlunge);
|
||||
spindle = Math.min(spindleMax, process.camContourSpindle);
|
||||
// deferred contour x outlining
|
||||
if (depthData.contourx.length > 0) {
|
||||
lastMode = PRO.CONTOUR_X;
|
||||
// force start at lower left corner
|
||||
// printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
|
||||
printPoint = tip2tipEmit(depthData.contourx, printPoint, function(el, point, count) {
|
||||
let poly = el.poly;
|
||||
if (poly.last() === point) poly.reverse();
|
||||
poly.forEachPoint(function(point, pidx) {
|
||||
camOut(point.clone(), pidx > 0);
|
||||
}, false);
|
||||
newLayer();
|
||||
return lastPoint;
|
||||
});
|
||||
}
|
||||
// deferred contour y outlining
|
||||
if (depthData.contoury.length > 0) {
|
||||
lastMode = PRO.CONTOUR_Y;
|
||||
// force start at lower left corner
|
||||
printPoint = tip2tipEmit(depthData.contoury, printPoint, function(el, point, count) {
|
||||
let poly = el.poly;
|
||||
if (poly.last() === point) poly.reverse();
|
||||
poly.forEachPoint(function(point, pidx) {
|
||||
camOut(point.clone(), pidx > 0);
|
||||
}, false);
|
||||
newLayer();
|
||||
return lastPoint;
|
||||
});
|
||||
}
|
||||
}
|
||||
depthData.trace.forEach(slice => {
|
||||
emitTrace(slice);
|
||||
});
|
||||
}
|
||||
|
||||
// drilling is always depth first, and always output last (change?)
|
||||
if (false && depthData.drill.length > 0) {
|
||||
lastMode = PRO.DRILL;
|
||||
setTool(process.camDrillTool, process.camDrillDownSpeed, process.camDrillDownSpeed);
|
||||
emitDrills(depthData.drill);
|
||||
}
|
||||
|
||||
// last layer/move is to zmax
|
||||
// injected into the last layer generated
|
||||
if (lastPoint)
|
||||
|
|
|
|||
|
|
@ -23,26 +23,13 @@
|
|||
* @param {Function} output
|
||||
*/
|
||||
CAM.slice = function(settings, widget, onupdate, ondone) {
|
||||
let conf = settings,
|
||||
proc = conf.process,
|
||||
let mesh = widget.mesh,
|
||||
proc = settings.process,
|
||||
stock = settings.stock || {},
|
||||
hasStock = stock.x && stock.y && stock.z && proc.camStockOn,
|
||||
camOps = widget.camops = [],
|
||||
sliceAll = widget.slices = [],
|
||||
unitsName = settings.controller.units,
|
||||
procOutlineWide = proc.camOutlineWide,
|
||||
procOutlineOut = proc.camOutlineOut,
|
||||
procOutlineIn = proc.camOutlineIn,
|
||||
procOutlineOn = proc.camOutlineOn,
|
||||
procOutline = procOutlineOn && proc.camOutlineDown,
|
||||
procContourX = proc.camContourXOn && proc.camOutlinePlunge,
|
||||
procContourY = proc.camContourYOn && proc.camOutlinePlunge,
|
||||
procContour = procContourX || procContourY,
|
||||
procDrill = proc.camDrillingOn && proc.camDrillDown && proc.camDrillDownSpeed,
|
||||
procDrillReg = proc.camDrillReg,
|
||||
outlineDown = procOutline ? proc.camOutlineDown : Infinity,
|
||||
bounds = widget.getBoundingBox(),
|
||||
mesh = widget.mesh,
|
||||
zBottom = proc.camZBottom,
|
||||
zMin = Math.max(bounds.min.z, zBottom),
|
||||
zMax = bounds.max.z,
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ kiri.lang['en-us'] = {
|
|||
cc_spnd_s: "spindle rpm",
|
||||
cc_spnd_l: "spindle speed in\nrevolutions / minute",
|
||||
cc_sovr_s: "step over",
|
||||
cc_sovr_l: "0.1 - 1.0\nfraction of\ntool diameter",
|
||||
cc_sovr_l: "as a fraction of\ntool diameter",
|
||||
cc_sdwn_s: "step down",
|
||||
cc_sdwn_l: "step down depth\nfor each pass\nin workspace units\n0 to disable",
|
||||
cc_feed_s: "feed rate",
|
||||
|
|
|
|||
Loading…
Reference in a new issue