fix multi-part path output and lathe light mode colors in CAM mode

This commit is contained in:
Stewart Allen 2023-03-22 13:53:33 -04:00
commit 7ff60c30ae
4 changed files with 9 additions and 8 deletions

View file

@ -21,7 +21,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* CAM stock is now always on, whether offset or absolute * CAM stock is now always on, whether offset or absolute
* CAM add lathe worker parallelization (2x - 6x speedup) * CAM add lathe worker parallelization (2x - 6x speedup)
* CAM fix pocket/trace selection with flip op * CAM fix pocket/trace selection with flip op
- fix lathe yellow path in light mode - CAM fix lathe yellow path in light mode
# Release 3.8 (2023-01-21) # Release 3.8 (2023-01-21)

View file

@ -454,7 +454,7 @@ kiri.load(() => {
pathIndex++; pathIndex++;
// console.log(next.point.z); // console.log(next.point.z);
if (next.tool >= 0 && (!tool || tool.getNumber() !== next.tool)) { if (next.tool && (!tool || tool.getID() !== next.tool.getID())) {
// on real tool change, go to safe Z first // on real tool change, go to safe Z first
if (tool && last.point) { if (tool && last.point) {
let pos = last.point = { let pos = last.point = {
@ -465,7 +465,7 @@ kiri.load(() => {
toolMove(pos); toolMove(pos);
send.data(toolUpdateMsg); send.data(toolUpdateMsg);
} }
toolUpdate(next.tool, send); toolUpdate(next.tool.getID(), send);
} }
const id = toolID; const id = toolID;
@ -582,11 +582,11 @@ kiri.load(() => {
} }
// delete old tool mesh, generate tool mesh, send to client // delete old tool mesh, generate tool mesh, send to client
function toolUpdate(toolnum, send) { function toolUpdate(toolid, send) {
if (tool) { if (tool) {
send.data({ mesh_del: toolID }); send.data({ mesh_del: toolID });
} }
tool = new CAM.Tool({ tools }, undefined, toolnum); tool = new CAM.Tool({ tools }, toolid);
const Instance = CSG.Instance(); const Instance = CSG.Instance();
const slen = tool.shaftLength() || 15; const slen = tool.shaftLength() || 15;
const srad = tool.shaftDiameter() / 2; const srad = tool.shaftDiameter() / 2;

View file

@ -478,7 +478,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
opSum += weight; opSum += weight;
if (tool && lastPoint) { if (tool && lastPoint) {
newLayer(); newLayer();
camOut(printPoint = lastPoint.clone().setZ(zmax + zadd)); layerPush(printPoint = lastPoint.clone().setZ(zmax + zadd), 0, 0, tool);
newLayer(); newLayer();
} }
} }

View file

@ -73,6 +73,7 @@ class Topo4 {
this.diam = tool.fluteDiameter(); this.diam = tool.fluteDiameter();
this.zoff = widget.track.top || 0; this.zoff = widget.track.top || 0;
this.leave = op.leave || 0; this.leave = op.leave || 0;
this.lineColor = state.settings.controller.dark ? 0xffff00 : 0x555500;
onupdate(0, "lathe"); onupdate(0, "lathe");
@ -352,7 +353,7 @@ class Topo4 {
const repeat = poly.points[0]; const repeat = poly.points[0];
slice.camLines[0].push(repeat.clone().setA(repeat.a - 360)); slice.camLines[0].push(repeat.clone().setA(repeat.a - 360));
slice.output() slice.output()
.setLayer("lathe", { line: 0xffff00 }) .setLayer("lathe", { line: this.lineColor })
.addPoly(poly.clone().applyRotations().move({ z: -zoff, x:0, y:0 })); .addPoly(poly.clone().applyRotations().move({ z: -zoff, x:0, y:0 }));
} }
@ -428,7 +429,7 @@ class Topo4 {
const repeat = poly.points[0]; const repeat = poly.points[0];
slice.camLines[0].push(repeat.clone().setA(repeat.a - 360)); slice.camLines[0].push(repeat.clone().setA(repeat.a - 360));
slice.output() slice.output()
.setLayer("lathe", { line: 0xffff00 }) .setLayer("lathe", { line: this.lineColor })
.addPoly(poly.clone().applyRotations().move({ z: -zoff, x:0, y:0 })); .addPoly(poly.clone().applyRotations().move({ z: -zoff, x:0, y:0 }));
} }