From 8da1aa5689ea6b7551c802b164faaa81df2f2823 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 12 Mar 2025 20:07:36 -0400 Subject: [PATCH] suppress indexed lerp output points. invert a axis input/output b/c display rotation is inverted --- src/kiri-mode/cam/export.js | 11 +++++++++-- src/kiri-mode/cam/prepare.js | 8 ++++++-- src/kiri/export.js | 3 +++ src/kiri/print.js | 3 ++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/kiri-mode/cam/export.js b/src/kiri-mode/cam/export.js index a42785d2..32830778 100644 --- a/src/kiri-mode/cam/export.js +++ b/src/kiri-mode/cam/export.js @@ -76,7 +76,8 @@ CAM.export = function(print, online) { scale = { x: 1, y: 1, - z: 1 + z: 1, + a: 1 }, consts = { box: runbox, @@ -281,7 +282,7 @@ CAM.export = function(print, online) { } if (da) { pos.a = newpos.a; - nl.append(space).append(axis.A).append(add0(consts.pos_a = pos.a * factor)); + nl.append(space).append(axis.A).append(add0(consts.pos_a = pos.a * -factor)); } if (newFeed) { pos.f = feed; @@ -342,6 +343,7 @@ CAM.export = function(print, online) { if (map.X) scale.x = map.X; if (map.Y) scale.y = map.Y; if (map.Z) scale.z = map.Z; + if (map.A) scale.a = map.A; if (map.DEC !== undefined) decimals = parseInt(map.DEC); console.log('export scaling applied', map); } catch (e) { @@ -408,6 +410,7 @@ CAM.export = function(print, online) { point.x *= scale.x; point.y *= scale.y; point.z *= scale.z; + point.a *= scale.a; } if (spro.outputInvertX) point.x = -point.x; if (spro.outputInvertY) point.y = -point.y; @@ -455,6 +458,10 @@ CAM.export = function(print, online) { newSpindle = layerout.spindle; // iterate over layer output records layerout.forEach((out, ind) => { + if (out.type === 'lerp') { + // suppress display only lerp points + return; + } if (out.gcode && Array.isArray(out.gcode)) { filterEmit(out.gcode, consts); } else { diff --git a/src/kiri-mode/cam/prepare.js b/src/kiri-mode/cam/prepare.js index 2fe9ef30..62e34825 100644 --- a/src/kiri-mode/cam/prepare.js +++ b/src/kiri-mode/cam/prepare.js @@ -105,6 +105,7 @@ function prepEach(widget, settings, print, firstPoint, update) { isContour, isRough, isLathe, + isIndex, tool, toolType, toolDiam, @@ -571,6 +572,7 @@ function prepEach(widget, settings, print, firstPoint, update) { setTolerance(0); nextIsMove = true; currentOp = op.op; + isIndex = currentOp.type === 'index'; isLathe = currentOp.type === 'lathe'; isRough = currentOp.type === 'rough'; isPocket = currentOp.type === 'pocket'; @@ -583,8 +585,10 @@ function prepEach(widget, settings, print, firstPoint, update) { opSum += weight; if (tool && lastPoint) { newLayer(); - layerPush(printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool); - newLayer(); + if (!isIndex) { + layerPush(printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool); + newLayer(); + } } } diff --git a/src/kiri/export.js b/src/kiri/export.js index ed34d05d..19eecfc9 100644 --- a/src/kiri/export.js +++ b/src/kiri/export.js @@ -482,6 +482,9 @@ function exportGCodeDialog(gcode, sections, info, names) { $('print-filename').value = filename; $('print-filesize').value = util.comma(info.bytes); $('print-filament').value = Math.round(info.distance); + if (set.controller.devel) { + $('code-preview-textarea').style.height = "30em"; + } calcTime(); if (fdm) { calcWeight(); diff --git a/src/kiri/print.js b/src/kiri/print.js index b4443b6f..7a80a0dc 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -404,7 +404,7 @@ class Print { if (pos.A) { let ip = new THREE.Vector3(pos.X, pos.Y, pos.Z) - .applyAxisAngle(XAXIS, pos.A * DEG2RAD); + .applyAxisAngle(XAXIS, -pos.A * DEG2RAD); point.x = ip.x; point.y = ip.y; point.z = ip.z; @@ -603,6 +603,7 @@ class Output { this.speed = speed; this.tool = tool; this.type = type; + // this.where = new Error().stack.split("\n"); } clone(z) {