From f6187d9c031a65a13fb8e467fa9ae150954bf36c Mon Sep 17 00:00:00 2001 From: Deqing Sun Date: Thu, 20 Dec 2018 00:15:31 -0500 Subject: [PATCH 1/2] check if hole is smaller than drill bit Hold smaller than bit will cause error in old firmware and freeze machine in new firmware. --- index.html | 1 + js/main.js | 6 ++++++ package.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) mode change 100644 => 100755 index.html mode change 100644 => 100755 js/main.js mode change 100644 => 100755 package.json diff --git a/index.html b/index.html old mode 100644 new mode 100755 index 0edffa1..794b310 --- a/index.html +++ b/index.html @@ -57,6 +57,7 @@

Hole Cutter

+
diff --git a/js/main.js b/js/main.js old mode 100644 new mode 100755 index 0fedc1c..246c1fa --- a/js/main.js +++ b/js/main.js @@ -115,6 +115,7 @@ function makeCircle(config) { var depth = Math.abs(parseFloat($('#depth').val())); var bitDiameter = parseFloat($('#bit-diameter').val()); var actualDiameter = (diameter - bitDiameter); + if (actualDiameter==0) actualDiameter = 0.001; var depthTotal = depth + cutThrough; var maxPlunge = bitDiameter * .75; var passes = Math.ceil(depthTotal / maxPlunge); @@ -137,6 +138,11 @@ function makeCircle(config) { "J2, 0,0" ]; var code = shopbotCode.join('\n'); + if (actualDiameter<=0){ + $("#err-msg").text("Can not cut a "+diameter+" inch hole with a "+bitDiameter+" inch bit."); + return; + } + $("#err-msg").text(""); fabmo.submitJob({ file: code, filename: 'example-circle.sbp', diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 6bb1ea5..fba1bf7 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "./index.html", "icon": "hole-icon.png", "icon_color": "white", - "version": "1.0.2", + "version": "1.0.2.1", "author": "Brendan Collins", "website": "http://www.shopbottools.com", "description": "Cut holes of specified dimensions", From ce996129b47f6ef3548d97f8069102f21b6b8a39 Mon Sep 17 00:00:00 2001 From: Deqing Sun Date: Thu, 20 Dec 2018 01:02:36 -0500 Subject: [PATCH 2/2] add option to set arbitrary hole center --- index.html | 6 ++++++ js/main.js | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 794b310..1cd3b0a 100755 --- a/index.html +++ b/index.html @@ -56,6 +56,12 @@

Hole Cutter

+
+ + +
+
+
diff --git a/js/main.js b/js/main.js index 246c1fa..42ca5b8 100755 --- a/js/main.js +++ b/js/main.js @@ -3,6 +3,16 @@ var yMax = 8.0; var xCenter = xMax / 2; var yCenter = yMax / 2; +var machineX = 0.0; +var machineY = 0.0; +var machineX = 0.0; + +fabmo.on('status', function(status) { + machineX = status.posx; + machineY = status.posy; + machineZ = status.posz; +}); + function getConfig(callback) { if(fabmo.isPresent()) { return fabmo.getConfig(callback); @@ -29,6 +39,7 @@ $(document).ready(function() { $('#diameter').attr('data-parsley-max', xMax); } }); + fabmo.requestStatus(); }); var $selector = $('#signupForm'), @@ -120,6 +131,12 @@ function makeCircle(config) { var maxPlunge = bitDiameter * .75; var passes = Math.ceil(depthTotal / maxPlunge); var plunge = (0 - (depthTotal / passes)).toFixed(5); + var useCurrentXY = $('#use-current-XY').is(":checked"); + if (useCurrentXY){ + xCenter = machineX; + yCenter = machineY; + } + var shopbotCode = ["'Simple Circle'", "'Center: " + xCenter + "," + yCenter + " Diameter: " + diameter + "'", "'Bit Diameter: " + bitDiameter + "'", @@ -134,8 +151,8 @@ function makeCircle(config) { "JZ, 1", "'Spindle Off'", "SO, 1,0", - "'Jog Home'", - "J2, 0,0" + useCurrentXY?"":"'Jog Home'", + useCurrentXY?"":"J2, 0,0" ]; var code = shopbotCode.join('\n'); if (actualDiameter<=0){