Merge pull request #397 from GridSpace/export-bugfix

Export bugfix
This commit is contained in:
Stewart Allen 2025-06-30 10:59:16 -07:00 • committed by GitHub
commit 5f159a02e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 6 deletions

View file

@ -167,6 +167,18 @@ CAM.export = function(print, online) {
}
/**
* Move to a point, applies post-processing including for laser/RML, and appends to output
* @param {Point} out.point - the point to move to
* @param {Tool} [out.tool] - the tool to move with
* @param {number} [out.speed] - the speed to move at (in mm/min)
* @param {number} [out.emit] - the emission state (0=off, 1=on)
* @param {boolean} [opt.newOp] - whether to force a new operation
* @param {number} [opt.dx] - the delta X change (if not given, uses out.point.x - pos.x)
* @param {number} [opt.dy] - the delta Y change (if not given, uses out.point.y - pos.y)
* @param {number} [opt.dz] - the delta Z change (if not given, uses out.point.z - pos.z)
* @param {number} [opt.time] - the time to move (in ms) (if not given, calculate from speed)
*/
function moveTo(out, opt = {}) {
let laser = out.type === 'laser';
let newpos = out.point;
@ -224,14 +236,16 @@ CAM.export = function(print, online) {
moveTo({
// speed: Infinity,
tool: out.tool,
point: { x: pos.x, y: pos.y, z: newpos.z, a: newpos.a }
point: { x: pos.x, y: pos.y, z: newpos.z, a: newpos.a },
emit: 0,
}, {
dx: 0, dy: 0, dz: 1, time: 0
});
moveTo({
// speed: Infinity,
tool: out.tool,
point: { x: newpos.x, y: newpos.y, z: newpos.z, a: pos.a }
point: { x: newpos.x, y: newpos.y, z: newpos.z, a: pos.a },
emit: 1,
}, {
dx: 1, dy: 1, dz: 0, time: 0
});
@ -239,14 +253,16 @@ CAM.export = function(print, online) {
moveTo({
// speed: Infinity,
tool: out.tool,
point: { x: newpos.x, y: newpos.y, z: pos.z, a: pos.a }
point: { x: newpos.x, y: newpos.y, z: pos.z, a: pos.a },
emit: 0
}, {
dx: 1, dy: 1, dz: 0, time: 0
});
moveTo({
// speed: Infinity,
tool: out.tool,
point: { x: newpos.x, y: newpos.y, z: newpos.z, a: newpos.a }
point: { x: newpos.x, y: newpos.y, z: newpos.z, a: newpos.a },
emit: 1
}, {
dx: 0, dy: 0, dz: 1, time: 0
});

View file

@ -646,8 +646,8 @@ class Output {
const { type, center, arcPoints } = (options ?? {});
//speed, tool, type, center, arcPoints
this.point = point; // point to emit
this.emit = emit; // emit (feed for printers, power for lasers, cut for cam)
this.point = point;
this.emit = Number(emit); //convert bools into 0/1
this.speed = speed;
this.tool = tool;
this.type = type;