checkpoint new register path

This commit is contained in:
Stewart Allen 2021-01-13 10:04:27 -05:00
commit a2ebff2a6d
5 changed files with 94 additions and 19 deletions

View file

@ -9,6 +9,7 @@
* `P` allow selection to me decimated on demand (context menu?)
* `P` improve decimation speed: omit point conversion or use wasm
* `P` client/worker interface normalization
* `P` explore widget vertex reloading / replacing
# FDM
@ -50,6 +51,8 @@
# CAM
* `B` trace follow open polys should "heal" if ends touch
* `B` trace open polys are not wound consistently
* `B` path routing with tabs sometimes makes no sense
* `B` clicking on a pop-op should pin it until clicked or [esc]
* `B` need to force cut line at synthetic z bottom (midlines, etc)
@ -60,6 +63,7 @@
* `B` climb vs conventional not fully consistent after refactor
* `B` outside cutting direction in roughing mode inverted
* `F` trace follow hole that matches endmill should turn into a drill op
* `F` new registration style: offset cutout
* `F` add climb/conventional into each operation
* `F` z thru should apply to any thru hole

View file

@ -460,6 +460,7 @@
camDrillDwell: 250,
camDrillLift: 2,
camDrillingOn: false,
camRegisterSpeed: 1000,
camFlipAxis: "X",
camFlipOther: "",
// camDrillReg: "none",

View file

@ -197,7 +197,8 @@
],
regaxis: [
{ name: "X" },
{ name: "Y" }
{ name: "Y" },
{ name: "-" }
],
regpoints: [
{ name: "2" },

View file

@ -909,16 +909,18 @@
rate: 'camDrillDownSpeed',
dwell: 'camDrillDwell',
lift: 'camDrillLift',
feed: 'camRegisterSpeed',
}).inputs = {
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
points: UC.newSelect(LANG.cd_points, {}, "regpoints"),
points: UC.newSelect(LANG.cd_points, {show:() => poppedRec.axis !== '-'}, "regpoints"),
sep: UC.newBlank({class:"pop-sep"}),
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
feed: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true, show:() => poppedRec.axis === '-'}),
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true}),
rate: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, units:true}),
dwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat}),
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true})
dwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat, show:() => poppedRec.axis !== '-'}),
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true, show:() => poppedRec.axis !== '-'})
};
createPopOp('flip', {

View file

@ -883,7 +883,8 @@
slice(progress) {
let { op, state } = this;
let { settings, widget, bounds, sliceAll, tslices, updateToolDiams, zThru } = state;
let { settings, widget, bounds, sliceAll, tslices, zMax, zThru } = state;
let { updateToolDiams } = state;
let tool = new CAM.Tool(settings, op.tool);
let sliceOut = this.sliceOut = [];
@ -891,36 +892,102 @@
updateToolDiams(tool.fluteDiameter());
let { stock } = settings,
lx = bounds.min.x,
hx = bounds.max.x,
ly = bounds.min.y,
hy = bounds.max.y,
o3 = tool.fluteDiameter() * 2,
mx = (bounds.max.x + bounds.min.x) / 2,
my = (bounds.max.y + bounds.min.y) / 2,
mx = (lx + hx) / 2,
my = (ly + hy) / 2,
mz = zThru || 0,
dx = (stock.x - (bounds.max.x - bounds.min.x)) / 4,
dy = (stock.y - (bounds.max.y - bounds.min.y)) / 4,
dx = (stock.x - (hx - lx)) / 4,
dy = (stock.y - (hy - ly)) / 4,
dz = stock.z,
points = [];
if (!(stock.x && stock.y && stock.z)) {
return;
}
switch (op.axis) {
case "X":
case "x":
if (op.points == 3) {
points.push(newPoint(bounds.min.x - dx, my, 0));
points.push(newPoint(bounds.max.x + dx, my - o3, 0));
points.push(newPoint(bounds.max.x + dx, my + o3, 0));
points.push(newPoint(lx - dx, my, 0));
points.push(newPoint(hx + dx, my - o3, 0));
points.push(newPoint(hx + dx, my + o3, 0));
} else {
points.push(newPoint(bounds.min.x - dx, my, 0));
points.push(newPoint(bounds.max.x + dx, my, 0));
points.push(newPoint(lx - dx, my, 0));
points.push(newPoint(hx + dx, my, 0));
}
break;
case "Y":
case "y":
if (op.points == 3) {
points.push(newPoint(mx, bounds.min.y - dy, 0));
points.push(newPoint(mx - o3, bounds.max.y + dy, 0));
points.push(newPoint(mx + o3, bounds.max.y + dy, 0));
points.push(newPoint(mx, ly - dy, 0));
points.push(newPoint(mx - o3, hy + dy, 0));
points.push(newPoint(mx + o3, hy + dy, 0));
} else {
points.push(newPoint(mx, bounds.min.y - dy, 0));
points.push(newPoint(mx, bounds.max.y + dy, 0));
points.push(newPoint(mx, ly - dy, 0));
points.push(newPoint(mx, hy + dy, 0));
}
break;
case "-":
let o2 = o3 / 2,
x0 = lx - dx,
x1 = hx + dx,
y0 = ly - dy - o2,
y1 = hy + dy + o2,
x4 = (x1 - x0 - o2 * 2) / 4,
y4 = (y1 - y0 - o2 * 2) / 4,
poly, cp, cz;
function start(z) {
cz = z;
cp = {x:x0 + o2, y:y0 + o2};
poly = newPolygon().add(cp.x, cp.y, z).setOpen();
}
function move(dx, dy) {
cp.x += dx;
cp.y += dy;
poly.add(cp.x, cp.y, cz);
}
function rept(count, tv, fn) {
while (count-- > 0) {
fn(tv, count === 0);
tv = -tv;
}
}
for (let z of BASE.util.lerp(zMax, -zThru, op.down)) {
let slice = newSlice(z);
sliceAll.push(slice);
sliceOut.push(slice);
start(z);
rept(4, o2, (oy, last) => {
move(0, -oy);
move(x4, 0);
});
rept(4, o2, (ox, last) => {
move(ox, 0);
move(0, y4);
});
rept(4, o2, (oy, last) => {
move(0, oy);
move(-x4, 0);
});
rept(4, o2, (ox, last) => {
move(-ox, 0);
move(0, -y4);
});
slice.camTrace = { tool, rate: op.feed, plunge: op.rate };
slice.camLines = [ poly ];
slice.output()
.setLayer("register", {line: 0xaa00aa}, false)
.addPolys(slice.camLines)
}
break;
}