formatting

This commit is contained in:
Stewart Allen 2025-07-15 18:36:35 -04:00
commit 6e6ad31600
4 changed files with 21 additions and 21 deletions

View file

@ -15,7 +15,7 @@ function createFilter(op) {
let idx = 0;
if (obj && obj.slices) {
const nadd = [];
filter = function(slices) {
filter = function (slices) {
for (let slice of slices) {
if (obj.slices(slice, idx++)) {
nadd.push(slice);
@ -78,7 +78,7 @@ class OpContour extends CamOp {
setSpindle(op.spindle);
setTolerance(this.tolerance);
printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
printPoint = newPoint(bounds.min.x, bounds.min.y, zmax);
for (let slice of sliceOut) {
// ignore debug slices
@ -88,17 +88,17 @@ class OpContour extends CamOp {
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});
polys.push({ first: poly.first(), last: poly.last(), poly: poly });
});
if (depthFirst) {
depthData.appendAll(polys);
} else {
printPoint = tip2tipEmit(polys, printPoint, function(el, point, count) {
printPoint = tip2tipEmit(polys, printPoint, function (el, point, count) {
poly = el.poly;
if (poly.last() === point) {
poly.reverse();
}
poly.forEachPoint(function(point, pidx) {
poly.forEachPoint(function (point, pidx) {
camOut(point.clone(), pidx > 0, stepover);
}, false);
});
@ -107,12 +107,12 @@ class OpContour extends CamOp {
}
if (depthFirst) {
printPoint = tip2tipEmit(depthData, printPoint, function(el, point, count) {
printPoint = tip2tipEmit(depthData, printPoint, function (el, point, count) {
let poly = el.poly;
if (poly.last() === point) {
poly.reverse();
}
poly.forEachPoint(function(point, pidx) {
poly.forEachPoint(function (point, pidx) {
camOut(point.clone(), pidx > 0, stepover);
}, false);
newLayer();

View file

@ -15,7 +15,7 @@ class OpDrill extends CamOp {
let { op, state } = this;
let { settings, addSlices, widget, updateToolDiams } = state;
let { zBottom, zThru, thruHoles, color } = state;
let { drills, drillThrough} = op
let { drills, drillThrough } = op
let drillTool = new Tool(settings, op.tool),
drillToolDiam = drillTool.fluteDiameter(),
@ -25,8 +25,8 @@ class OpDrill extends CamOp {
const allDrills = drills[widget.id] ?? []
// drill points to use center (average of all points) of the polygon
allDrills.forEach((drill)=> {
if(!drill.selected){
allDrills.forEach((drill) => {
if (!drill.selected) {
return
}
let slice = newSlice(0);
@ -36,10 +36,10 @@ class OpDrill extends CamOp {
}
drill.zBottom = drill.z - drill.depth;
// for thru holes, follow z thru when set
if ((op.thru>0) ) {
if ((op.thru > 0)) {
drill.zBottom -= op.thru;
}
const poly = newPolygon()
const poly = newPolygon()
poly.points.push(newPoint(drill.x, drill.y, drill.z))
poly.points.push(newPoint(drill.x, drill.y, drill.zBottom))
// poly.points.pop();
@ -47,7 +47,7 @@ class OpDrill extends CamOp {
slice.camLines = [poly];
slice.output()
.setLayer("drill", {face: color, line: color})
.setLayer("drill", { face: color, line: color })
.addPolys(slice.camLines);
addSlices(slice);
sliceOut.push(slice);
@ -59,7 +59,7 @@ class OpDrill extends CamOp {
let { settings, widget, addSlices, updateToolDiams } = state;
let { setTool, setSpindle, setDrill, emitDrills } = ops;
setTool(op.tool, undefined, op.rate);
setDrill(op.down, op.lift, op.dwell,op.thru);
setDrill(op.down, op.lift, op.dwell, op.thru);
setSpindle(op.spindle);
emitDrills(this.sliceOut.map(slice => slice.camLines).flat());
}

View file

@ -13,7 +13,7 @@ function createFilter(op) {
let idx = 0;
if (obj && obj.slices) {
const nadd = [];
filter = function(slices) {
filter = function (slices) {
for (let slice of slices) {
if (obj.slices(slice, idx++)) {
nadd.push(slice);
@ -110,7 +110,7 @@ class OpLathe extends CamOp {
// camOut(last = last.clone().setZ(zmax), 0);
// camOut(last = last.clone().setA(amax), 0);
newLayer();
ops.addGCode([`G0 Z${zmax.round(2)}`,`G0 A${amax}`,"G92 A0"]);
ops.addGCode([`G0 Z${zmax.round(2)}`, `G0 A${amax}`, "G92 A0"]);
setPrintPoint(last);
}

View file

@ -78,7 +78,7 @@ class OpRegister extends CamOp {
poly, cp, cz;
function start(z) {
cz = z;
cp = {x:x0 + o2 * 0.5, y:y0 + o2 * 1.5};
cp = { x: x0 + o2 * 0.5, y: y0 + o2 * 1.5 };
poly = newPolygon().add(cp.x, cp.y, z);
}
function move(dx, dy) {
@ -115,16 +115,16 @@ class OpRegister extends CamOp {
});
poly.points.pop();
slice.camTrace = { tool: tool.getID(), rate: op.feed, plunge: op.rate };
slice.camLines = [ poly ];
slice.camLines = [poly];
slice.output()
.setLayer("register", {line: color}, false)
.setLayer("register", { line: color }, false)
.addPolys(slice.camLines)
}
break;
}
if (points.length) {
let slice = newSlice(0,null), polys = [];
let slice = newSlice(0, null), polys = [];
points.forEach(point => {
polys.push(newPolygon()
.append(point.clone().setZ(z1))
@ -132,7 +132,7 @@ class OpRegister extends CamOp {
});
slice.camLines = polys;
slice.output()
.setLayer("register", {face: color, line: color})
.setLayer("register", { face: color, line: color })
.addPolys(polys);
addSlices(slice);
sliceOut.push(slice);