Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve hole cutter app #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ <h1 class='title'>Hole Cutter</h1>
<label class='advanced' for="bit-diameter">Bit Diameter (in)</label>
<input class='advanced' id="bit-diameter" type="number" step="any" data-parsley-required="true" placeholder="Bit Diameter" data-parsley-maxlength="5" data-parsley-min="0" value="0.25" disabled>
</div>
<div class="pure-control-group">
<label class='advanced' for="use-current-XY">Use Current XY as center of hole</label>
<input class='advanced' id="use-current-XY" type="checkbox" placeholder="Use Current XY" value=False disabled>
<br>
<br>
</div>
<button id="submit" >Next</button>
<div id="err-msg"><div>
</fieldset>
</div>

Expand Down
27 changes: 25 additions & 2 deletions js/main.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -29,6 +39,7 @@ $(document).ready(function() {
$('#diameter').attr('data-parsley-max', xMax);
}
});
fabmo.requestStatus();
});

var $selector = $('#signupForm'),
Expand Down Expand Up @@ -115,10 +126,17 @@ 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);
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 + "'",
Expand All @@ -133,10 +151,15 @@ 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){
$("#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',
Expand Down
2 changes: 1 addition & 1 deletion package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down