fix multi-widget stock bounds after load. fix first point on first widget in multi-widget setup. fix first move not cut
This commit is contained in:
parent
0d320cd167
commit
9a865f957a
4 changed files with 14 additions and 20 deletions
|
|
@ -1294,9 +1294,6 @@
|
||||||
csz += max.z - min.z;
|
csz += max.z - min.z;
|
||||||
csox = min.x + ((max.x - min.x) / 2);
|
csox = min.x + ((max.x - min.x) / 2);
|
||||||
csoy = min.y + ((max.y - min.y) / 2);
|
csoy = min.y + ((max.y - min.y) / 2);
|
||||||
// $('stock-width').innerText = (csx/scale).toFixed(2);
|
|
||||||
// $('stock-depth').innerText = (csy/scale).toFixed(2);
|
|
||||||
// $('stock-height').innerText = (csz/scale).toFixed(2);
|
|
||||||
}
|
}
|
||||||
if (!camStock) {
|
if (!camStock) {
|
||||||
let geo = new THREE.BoxGeometry(1, 1, 1);
|
let geo = new THREE.BoxGeometry(1, 1, 1);
|
||||||
|
|
|
||||||
|
|
@ -171,14 +171,15 @@
|
||||||
let vertices = data.geo || data,
|
let vertices = data.geo || data,
|
||||||
track = data.track || undefined,
|
track = data.track || undefined,
|
||||||
group = data.group || id,
|
group = data.group || id,
|
||||||
widget = newWidget(id, Group.forid(group));
|
widget = newWidget(id, Group.forid(group)),
|
||||||
|
ptr = widget.loadVertices(vertices);
|
||||||
widget.saved = time();
|
widget.saved = time();
|
||||||
ondone(widget.loadVertices(vertices));
|
|
||||||
// restore widget position if specified
|
// restore widget position if specified
|
||||||
if (move && track && track.pos) {
|
if (move && track && track.pos) {
|
||||||
widget.track = track;
|
widget.track = track;
|
||||||
widget.move(track.pos.x, track.pos.y, track.pos.z, true);
|
widget.move(track.pos.x, track.pos.y, track.pos.z, true);
|
||||||
}
|
}
|
||||||
|
ondone(ptr);
|
||||||
} else {
|
} else {
|
||||||
ondone(null);
|
ondone(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@
|
||||||
"facing",
|
"facing",
|
||||||
"drilling"
|
"drilling"
|
||||||
],
|
],
|
||||||
MIN = Math.min,
|
|
||||||
MAX = Math.max,
|
|
||||||
HPI = Math.PI/2,
|
HPI = Math.PI/2,
|
||||||
SLICER = KIRI.slicer,
|
SLICER = KIRI.slicer,
|
||||||
newLine = BASE.newLine,
|
newLine = BASE.newLine,
|
||||||
|
|
@ -468,7 +466,7 @@
|
||||||
gridy,
|
gridy,
|
||||||
gridi, // index
|
gridi, // index
|
||||||
gridv, // value
|
gridv, // value
|
||||||
zMin = MAX(bounds.min.z, outp.camZBottom) + 0.0001,
|
zMin = Math.max(bounds.min.z, outp.camZBottom) + 0.0001,
|
||||||
x, y, tv, ltv;
|
x, y, tv, ltv;
|
||||||
|
|
||||||
// for each Y slice, find z grid value (x/z swapped)
|
// for each Y slice, find z grid value (x/z swapped)
|
||||||
|
|
@ -857,7 +855,7 @@
|
||||||
anyFinish = procFinish || procFinishX || procFinishY,
|
anyFinish = procFinish || procFinishX || procFinishY,
|
||||||
procFacing = proc.roughingOn && proc.camZTopOffset,
|
procFacing = proc.roughingOn && proc.camZTopOffset,
|
||||||
procDrill = proc.drillingOn && proc.drillDown && proc.drillDownSpeed,
|
procDrill = proc.drillingOn && proc.drillDown && proc.drillDownSpeed,
|
||||||
sliceDepth = MAX(0.1, MIN(proc.roughingDown, proc.finishingDown) / 3) * units,
|
sliceDepth = Math.max(0.1, Math.min(proc.roughingDown, proc.finishingDown) / 3) * units,
|
||||||
pocketOnlyRough = proc.camPocketOnlyRough,
|
pocketOnlyRough = proc.camPocketOnlyRough,
|
||||||
pocketOnlyFinish = proc.camPocketOnlyFinish,
|
pocketOnlyFinish = proc.camPocketOnlyFinish,
|
||||||
addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough,
|
addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough,
|
||||||
|
|
@ -866,7 +864,7 @@
|
||||||
tabHeight = proc.camTabsHeight * units,
|
tabHeight = proc.camTabsHeight * units,
|
||||||
mesh = widget.mesh,
|
mesh = widget.mesh,
|
||||||
bounds = widget.getBoundingBox(),
|
bounds = widget.getBoundingBox(),
|
||||||
zMin = MAX(bounds.min.z, proc.camZBottom) * units,
|
zMin = Math.max(bounds.min.z, proc.camZBottom) * units,
|
||||||
roughingStock = proc.roughingStock * units,
|
roughingStock = proc.roughingStock * units,
|
||||||
shellRough,
|
shellRough,
|
||||||
shellFinish,
|
shellFinish,
|
||||||
|
|
@ -982,7 +980,7 @@
|
||||||
zstep = proc.roughingDown * units;
|
zstep = proc.roughingDown * units;
|
||||||
|
|
||||||
while (zpos >= ztop) {
|
while (zpos >= ztop) {
|
||||||
zpos = zpos - MIN(zstep, zpos - ztop);
|
zpos = zpos - Math.min(zstep, zpos - ztop);
|
||||||
|
|
||||||
const slice = newSlice(zpos, mesh.newGroup ? mesh.newGroup() : null);
|
const slice = newSlice(zpos, mesh.newGroup ? mesh.newGroup() : null);
|
||||||
slice.camMode = CPRO.FACING;
|
slice.camMode = CPRO.FACING;
|
||||||
|
|
@ -1363,7 +1361,7 @@
|
||||||
// before first point, move cutting head to point above it
|
// before first point, move cutting head to point above it
|
||||||
layerPush(point.clone().setZ(zmax), 0, 0, tool.number);
|
layerPush(point.clone().setZ(zmax), 0, 0, tool.number);
|
||||||
// then set that as the lastPoint
|
// then set that as the lastPoint
|
||||||
lastPoint = newPoint(origin.x, origin.y, point.z);
|
lastPoint = point;
|
||||||
}
|
}
|
||||||
|
|
||||||
let deltaXY = lastPoint.distTo2D(point),
|
let deltaXY = lastPoint.distTo2D(point),
|
||||||
|
|
@ -1389,7 +1387,7 @@
|
||||||
} //else (TODO verify no else here b/c above could change isMove)
|
} //else (TODO verify no else here b/c above could change isMove)
|
||||||
// move over things
|
// move over things
|
||||||
if ((deltaXY > toolDiam || (deltaZ > toolDiam && deltaXY > tolerance)) && (isMove || absDeltaZ >= tolerance)) {
|
if ((deltaXY > toolDiam || (deltaZ > toolDiam && deltaXY > tolerance)) && (isMove || absDeltaZ >= tolerance)) {
|
||||||
let maxz = toolProfile ? MAX(
|
let maxz = toolProfile ? Math.max(
|
||||||
getTopoZPathMax(
|
getTopoZPathMax(
|
||||||
widget,
|
widget,
|
||||||
toolProfile,
|
toolProfile,
|
||||||
|
|
@ -1399,7 +1397,7 @@
|
||||||
point.y - wmy) + zadd,
|
point.y - wmy) + zadd,
|
||||||
point.z,
|
point.z,
|
||||||
lastPoint.z) : zmax,
|
lastPoint.z) : zmax,
|
||||||
mustGoUp = MAX(maxz - point.z, maxz - lastPoint.z) >= tolerance,
|
mustGoUp = Math.max(maxz - point.z, maxz - lastPoint.z) >= tolerance,
|
||||||
clearz = maxz;
|
clearz = maxz;
|
||||||
// up if any point between higher than start/finish
|
// up if any point between higher than start/finish
|
||||||
if (mustGoUp) {
|
if (mustGoUp) {
|
||||||
|
|
@ -1415,7 +1413,7 @@
|
||||||
}
|
}
|
||||||
// synth new plunge rate
|
// synth new plunge rate
|
||||||
if (deltaZ <= -tolerance) {
|
if (deltaZ <= -tolerance) {
|
||||||
let threshold = MIN(deltaXY / 2, absDeltaZ),
|
let threshold = Math.min(deltaXY / 2, absDeltaZ),
|
||||||
modifier = threshold / absDeltaZ;
|
modifier = threshold / absDeltaZ;
|
||||||
if (threshold && modifier && deltaXY > tolerance) {
|
if (threshold && modifier && deltaXY > tolerance) {
|
||||||
// use modifier to speed up long XY move plunge rates
|
// use modifier to speed up long XY move plunge rates
|
||||||
|
|
@ -1827,13 +1825,11 @@
|
||||||
points++;
|
points++;
|
||||||
moveTo({
|
moveTo({
|
||||||
tool: out.tool,
|
tool: out.tool,
|
||||||
point: { x: 0, y: 0, z: newpos.z },
|
point: { x: 0, y: 0, z: newpos.z }
|
||||||
speed: maxZd
|
|
||||||
});
|
});
|
||||||
moveTo({
|
moveTo({
|
||||||
tool: out.tool,
|
tool: out.tool,
|
||||||
point: { x: newpos.x, y: newpos.y, z: newpos.z },
|
point: { x: newpos.x, y: newpos.y, z: newpos.z }
|
||||||
speed: maxXYd
|
|
||||||
});
|
});
|
||||||
points--;
|
points--;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -733,7 +733,7 @@ th, tr, td {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
#catalogList .label {
|
#catalogList .label {
|
||||||
width: 10em;
|
width: 12em;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
#catalogList .rename {
|
#catalogList .rename {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue