diff --git a/src/kiri/core/conf.js b/src/kiri/core/conf.js index 1182356e..d9e6d399 100644 --- a/src/kiri/core/conf.js +++ b/src/kiri/core/conf.js @@ -511,6 +511,7 @@ export const conf = { camLaserZMax: 0, camLaserZMin: 0, camLatheAngle: 1, + camLatheAxisReset: ["G92.4 A0 R0"], camLatheLinear: true, camLatheOver: 0.1, camLatheSpeed: 500, diff --git a/src/kiri/mode/cam/cl-ops.js b/src/kiri/mode/cam/cl-ops.js index c9c87bbe..4265be34 100644 --- a/src/kiri/mode/cam/cl-ops.js +++ b/src/kiri/mode/cam/cl-ops.js @@ -349,10 +349,10 @@ export function createPopOps() { leave: 'camContourLeave', linear: 'camLatheLinear', offStart: 'camLatheOffStart', - offEnd: 'camLatheOffEnd' + offEnd: 'camLatheOffEnd', + axisreset: 'camLatheAxisReset' }).inputs = { tool: UC.newSelect(LANG.cc_tool, {}, "tools"), - // axis: UC.newSelect(LANG.cd_axis, {}, "xyaxis"), sep: UC.newBlank({ class: "pop-sep" }), spindle: UC.newInput(LANG.cc_spnd_s, { title: LANG.cc_spnd_l, convert: toInt, show: hasSpindle }), rate: UC.newInput(LANG.cc_feed_s, { title: LANG.cc_feed_l, convert: toInt, units }), @@ -367,12 +367,12 @@ export function createPopOps() { leave: UC.newInput(LANG.cf_leav_s, { title: LANG.cf_leav_l, convert: toFloat, bound: UC.bound(0, 100) }), sep: UC.newBlank({ class: "pop-sep" }), linear: UC.newBoolean(LANG.ci_line_s, undefined, { title: LANG.ci_line_l }), - // filter: UC.newRow([ UC.newButton(LANG.filter, contourFilter) ], {class:"ext-buttons f-row"}) + axisreset: UC.newRow([ UC.newButton("axis reset", gcodeEditor('Rotary (A) Axis Reset Macro', 'axisreset')) ], { class: "ext-buttons f-row" }) }; function canDogBones() { if (!env.poppedRec) return false; - return env.poppedRec.mode === 'follow';// && env.poppedRec.offset && env.poppedRec.offset !== 'none'; + return env.poppedRec.mode === 'follow'; } function canDogBonesRev() { diff --git a/src/kiri/mode/cam/op-lathe.js b/src/kiri/mode/cam/op-lathe.js index 9edcb01f..4ad5b9bc 100644 --- a/src/kiri/mode/cam/op-lathe.js +++ b/src/kiri/mode/cam/op-lathe.js @@ -1,7 +1,6 @@ /** Copyright Stewart Allen -- All Rights Reserved */ import { CamOp } from './op.js'; -import { Tool } from './tool.js'; import { generate as topo4_generate } from './topo4.js'; import { newPoint } from '../../../geo/point.js'; @@ -55,7 +54,8 @@ class OpLathe extends CamOp { prepare(ops, progress) { let { op, slices, topo } = this; - let { camOut, getLastPoint, newLayer, setContouring, setNextIsMove, zSafe } = ops; + let { axisreset } = op; + let { camOut, newLayer, setContouring, setNextIsMove, zSafe } = ops; let rez = topo.resolution; @@ -80,10 +80,8 @@ class OpLathe extends CamOp { } // move to safe height and reset A axis - let last = getLastPoint(); - let amax = (Math.round(last.a / 360) * 360).round(2); newLayer(); - ops.addGCode([`G0 Z${zSafe.round(2)}`, `G0 A${amax}`, "G92 A0"]); + ops.addGCode([`G0 Z${zSafe.round(2)}`, axisreset.join('\n') ?? "G92.4 A0 R0"]); } } diff --git a/src/kiri/mode/cam/topo4.js b/src/kiri/mode/cam/topo4.js index a314fe6f..6352a609 100644 --- a/src/kiri/mode/cam/topo4.js +++ b/src/kiri/mode/cam/topo4.js @@ -159,7 +159,7 @@ export class Topo { } async sliceGPU(onupdate) { - const { angle, diam, linear, offStart, offEnd, resolution, tool, units, vertices, zBottom } = this; + const { angle, diam, leave, linear, offStart, offEnd, resolution, tool, units, vertices, zBottom } = this; // invert tool Z offset for gpu code let toolBounds = new THREE.Box3() @@ -217,7 +217,7 @@ export class Topo { let xoff = boundsOverride.min.x; let rows = []; for (let i=0; i newPoint(j * xmult + xoff, 0, v).setA(-i * degPerRow)); + let points = Array.from(strips[i].pathData).map((v,j) => newPoint(j * xmult + xoff, 0, v + leave).setA(-i * degPerRow)); rows.push(points); } if (linear) {