From 4fe1fb9c41a607aa54f01f6cd90b318871e1c521 Mon Sep 17 00:00:00 2001 From: wing Date: Tue, 20 Dec 2022 17:38:16 -0500 Subject: [PATCH] Add Rapid Z setting I found that the retraction speed was too fast for my z-axis. (old shapeko) It would screech and end up missing the target depth, then crashing through wood. What I found needing is a "rapid-z" setting for moving in the z axis when not cutting through material -- the equivalent of 'rapid' but not for x/y axis. --- js/Cam.js | 5 +++-- js/GcodeConversionViewModel.js | 6 ++++-- js/OperationsViewModel.js | 4 ++++ jscut.html | 4 ++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/js/Cam.js b/js/Cam.js index fbd5ee2..2b2a3d8 100644 --- a/js/Cam.js +++ b/js/Cam.js @@ -372,7 +372,8 @@ jscut.priv.cam = jscut.priv.cam || {}; var retractGcode = '; Retract\r\n' + - 'G1 Z' + safeZ.toFixed(decimal) + rapidFeedGcode + '\r\n'; + 'G1 Z' + safeZ.toFixed(decimal) + retractFeedGcode + '\r\n'; + var retractForTabGcode = '; Retract for tab\r\n' + @@ -420,7 +421,7 @@ jscut.priv.cam = jscut.priv.cam || {}; gcode += '; Rapid to initial position\r\n' + 'G1' + convertPoint(origPath[0], false) + rapidFeedGcode + '\r\n' + - 'G1 Z' + currentZ.toFixed(decimal) + '\r\n'; + 'G1 Z' + currentZ.toFixed(decimal) + retractFeedGcode + '\r\n'; var selectedPaths; if (nextZ >= tabZ || useZ) diff --git a/js/GcodeConversionViewModel.js b/js/GcodeConversionViewModel.js index 0a5934b..814b0d6 100644 --- a/js/GcodeConversionViewModel.js +++ b/js/GcodeConversionViewModel.js @@ -82,6 +82,7 @@ function GcodeConversionViewModel(options, miscViewModel, materialViewModel, too var safeZ = self.unitConverter.fromInch(materialViewModel.matZSafeMove.toInch()); var rapidRate = self.unitConverter.fromInch(toolModel.rapidRate.toInch()); var plungeRate = self.unitConverter.fromInch(toolModel.plungeRate.toInch()); + var rapidZRate = self.unitConverter.fromInch(toolModel.rapidZRate.toInch()); var cutRate = self.unitConverter.fromInch(toolModel.cutRate.toInch()); var passDepth = self.unitConverter.fromInch(toolModel.passDepth.toInch()); var topZ = self.unitConverter.fromInch(materialViewModel.matTopZ.toInch()); @@ -115,7 +116,7 @@ function GcodeConversionViewModel(options, miscViewModel, materialViewModel, too else gcode += "G21 ; Set units to mm\r\n"; gcode += "G90 ; Absolute positioning\r\n"; - gcode += "G1 Z" + safeZ + " F" + rapidRate + " ; Move to clearance level\r\n" + gcode += "G1 Z" + safeZ + " F" + rapidZRate + " ; Move to clearance level\r\n" for (var opIndex = 0; opIndex < ops.length; ++opIndex) { var op = ops[opIndex]; @@ -135,6 +136,7 @@ function GcodeConversionViewModel(options, miscViewModel, materialViewModel, too "\r\n; Cut Depth: " + cutDepth + "\r\n; Pass Depth: " + passDepth + "\r\n; Plunge rate: " + plungeRate + + "\r\n; Rapid Z rate: " + rapidZRate + "\r\n; Cut rate: " + cutRate + "\r\n;\r\n"; @@ -151,7 +153,7 @@ function GcodeConversionViewModel(options, miscViewModel, materialViewModel, too safeZ: safeZ, passDepth: passDepth, plungeFeed: plungeRate, - retractFeed: rapidRate, + retractFeed: rapidZRate, cutFeed: cutRate, rapidFeed: rapidRate, tabGeometry: tabGeometry, diff --git a/js/OperationsViewModel.js b/js/OperationsViewModel.js index 5efcc37..e63cba9 100644 --- a/js/OperationsViewModel.js +++ b/js/OperationsViewModel.js @@ -25,12 +25,14 @@ function ToolModel() { self.stepover = ko.observable(.4); self.rapidRate = ko.observable(100); self.plungeRate = ko.observable(5); + self.rapidZRate = ko.observable(10); self.cutRate = ko.observable(40); self.unitConverter.add(self.diameter); self.unitConverter.add(self.passDepth); self.unitConverter.add(self.rapidRate); self.unitConverter.add(self.plungeRate); + self.unitConverter.add(self.rapidZRate); self.unitConverter.add(self.cutRate); self.angle.subscribe(function (newValue) { @@ -68,6 +70,7 @@ function ToolModel() { 'stepover': self.stepover(), 'rapidRate': self.rapidRate(), 'plungeRate': self.plungeRate(), + 'rapidZRate': self.rapidZRate(), 'cutRate': self.cutRate(), }; } @@ -88,6 +91,7 @@ function ToolModel() { f(json.stepover, self.stepover); f(json.rapidRate, self.rapidRate); f(json.plungeRate, self.plungeRate); + f(json.rapidZRate, self.rapidZRate); f(json.cutRate, self.cutRate); } } diff --git a/jscut.html b/jscut.html index 621c49c..9f18cd8 100644 --- a/jscut.html +++ b/jscut.html @@ -369,6 +369,10 @@

/min + + + /min + /min