-
-

-
-
+
+

Custom Grbl Flashing Tool
+
+
You can use this wizard to flash customized instances of Grbl Firmware onto a compatible controller
Only use with care, or when instructed by Support
+
+
+
+
Flattening / Surfacing Tool
+
-
+
+
+
+
+
-
-
+
+
+
Update Ready
+
+ Version
1.0.100
update ready to be installed!
Note that proceeding will:
+
+ - Stops any running jobs
+ - Shuts down this instance of OpenBuilds CONTROL
+ - Launches the installer for the new version
+
+
You may want to wait until your machine is idle before continuing
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
-
+
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
+
+
+
+
-
+
-
+
-
+
+
+
-
+
\ No newline at end of file
diff --git a/app/js/main.js b/app/js/main.js
index 67c8be1..4096833 100644
--- a/app/js/main.js
+++ b/app/js/main.js
@@ -121,11 +121,10 @@ function loadFile(f) {
// if (f.name.match(/.gcode$/i)) {
r.readAsText(f);
r.onload = function(event) {
- // cleanupThree();
- // gcode = this.result;
editor.session.setValue(this.result);
- parseGcodeInWebWorker(this.result)
printLog('
[ GCODE Parser ] GCODE File Loaded, please wait while we render a preview... ');
+ parseGcodeInWebWorker(this.result)
+
};
// }
}
diff --git a/app/js/toolchange.js b/app/js/toolchange.js
new file mode 100644
index 0000000..28e7d43
--- /dev/null
+++ b/app/js/toolchange.js
@@ -0,0 +1,110 @@
+var toolchanges = [];
+
+function setupToolChanges(gcode) {
+ // scan gcode for tool change info
+ var fileLines = gcode
+ fileLines = fileLines.split("\n")
+ // console.log("about to look for tool changes in gcode editor:", fileLines.length, "\n\n\n");
+
+ var toolComments = {};
+ var toolChanges = {};
+ var toolChangesKeys = [];
+
+ for (var i = 0; i < fileLines.length; i++) {
+ var line = fileLines[i];
+
+ // see if we have line where comment starts with
+ // look for something like:
+ // (T1 D=3.175 CR=0. - ZMIN=-4.2 - FLAT END MILL)
+ // ;T1 1/4 inch flat bottom endmill
+ // T0 ; 1/4 inch flat bottom endmill
+ if (line.match(/\(T(\d+)\s+(.*)\)/i) || line.match(/\;T(\d+)\s+(.*)\)/i) || line.match(/\T(\d+)/i)) {
+ var toolNum = parseInt(RegExp.$1);
+ var toolComment = "T" + toolNum + " " + RegExp.$2;
+ console.log("found tool comment. lineNum:", i, "toolNum:", toolNum, "comment:", toolComment, "line:", line);
+ toolComments[toolNum] = {
+ lineNum: i + 1,
+ toolNum: toolNum,
+ toolComment: toolComment,
+ }
+ }
+
+ // look for M6 line
+ if (line.match(/M6|M06|M006/i)) {
+ var toolNum;
+ if (line.match(/T(\d+)/i)) {
+ toolNum = parseInt(RegExp.$1);
+ }
+ toolChanges[(i + 1)] = {
+ lineNum: i + 1,
+ toolNum: toolNum,
+ };
+ toolChangesKeys.push(i + 1);
+ // console.log("found tool change. lineNum:", i, "line:", line);
+ }
+ }
+
+ // console.log("this.toolComments:", toolComments);
+ // console.log("this.toolChanges:", toolChanges);
+
+ // now look for a comment up to 10 lines above the M6 tool change line to see if any comments are there
+ var keys = toolChangesKeys; //Object.keys(this.toolChanges).sort();
+ // console.log("looking for comments above m6 to get a label for this tool change. keys:", keys);
+ for (var i = 0; i < keys.length; i++) {
+ var toolChangeLineNum = keys[i];
+ var lookBackToLineNum = toolChangeLineNum - 10;
+ if (lookBackToLineNum < 1) lookBackToLineNum = 1; // first line
+
+ // now look backwards until we've seen just 1 comment
+ for (var lineNum = toolChangeLineNum; lineNum >= lookBackToLineNum; lineNum--) {
+ var line = fileLines[lineNum - 1]; // index of array is 1 less than lineNum
+ // console.log("looking at lineNum:", lineNum, "line:", line);
+ // see if comment
+ if (line.match(/\((.*?)\)/) || line.match(/;(.*)/)) {
+ var comment = RegExp.$1;
+ // console.log("found comment:", comment);
+
+ // stick comment into toolChanges
+ toolChanges[toolChangeLineNum].sectionComment = comment;
+
+ // break since we found one
+ break;
+ }
+ }
+ }
+
+ // console.log("after adding section comments. this.toolChanges:", toolChanges);
+ // console.log("after adding section comments. this.toolComments:", toolComments);
+ // console.log("after adding section comments. this.toolChangesKeys:", toolChangesKeys);
+
+ var toolChangesArray = []
+
+ for (var i = 0; i < keys.length; i++) {
+
+ var toolChange = toolChanges[keys[i]];
+ console.log(toolChange)
+ var tool = toolComments[toolChange.toolNum];
+ var newToolChange = {
+ lineNum: false,
+ toolNum: false,
+ toolComment: false,
+ sectionComment: false
+ }
+
+ newToolChange.toolNum = toolChange.toolNum
+ newToolChange.lineNum = toolChange.lineNum
+
+ if ('sectionComment' in toolChange) {
+ newToolChange.sectionComment = toolChange.sectionComment
+ }
+
+ if (tool != null) {
+ newToolChange.toolComment = tool.toolComment
+ }
+
+ toolChangesArray.push(newToolChange)
+ }
+
+ return toolChangesArray;
+
+}
\ No newline at end of file
diff --git a/app/js/ui.js b/app/js/ui.js
index 3543235..df7ba49 100644
--- a/app/js/ui.js
+++ b/app/js/ui.js
@@ -109,7 +109,13 @@ function setConnectBar(val, status) {
// Toolbar with play/pause/stop
function setControlBar(val, status) {
if (val == 0) { // Not Connected Yet
- $('#runBtn').hide().attr('disabled', true);
+ if (toolchanges.length) {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ }
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
@@ -127,10 +133,19 @@ function setControlBar(val, status) {
$('.estop').hide()
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
if (typeof ace !== 'undefined') {
- $('#runBtn').show().attr('disabled', editor.session.getLength() < 2);
- $('#chkSize').show().attr('disabled', editor.session.getLength() < 2);
+ if (toolchanges.length) {
+ $('#runToolsBtn').show().attr('disabled', editor.session.getLength() < 2);
+ $('#runBtn').hide().attr('disabled', editor.session.getLength() < 2);
+ $('#chkSize').show().attr('disabled', editor.session.getLength() < 2);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', editor.session.getLength() < 2);
+ $('#runBtn').show().attr('disabled', editor.session.getLength() < 2);
+ $('#chkSize').show().attr('disabled', editor.session.getLength() < 2);
+ }
+
} else {
$('#runBtn').show().attr('disabled', false);
+ $('#runToolsBtn').hide().attr('disabled', false);
}
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
@@ -146,7 +161,13 @@ function setControlBar(val, status) {
}
$('.estop').show()
} else if (val == 3) { // Busy Streaming GCODE
- $('#runBtn').hide().attr('disabled', true);
+ if (toolchanges.length) {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ }
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').show().attr('disabled', false);
@@ -162,7 +183,13 @@ function setControlBar(val, status) {
}
$('.estop').show()
} else if (val == 4) { // Paused
- $('#runBtn').hide().attr('disabled', true);
+ if (toolchanges.length) {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ }
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').show().attr('disabled', false);
$('#pauseBtn').hide().attr('disabled', true);
@@ -178,7 +205,14 @@ function setControlBar(val, status) {
}
$('.estop').show()
} else if (val == 5) { // Alarm State
- $('#runBtn').show().attr('disabled', true);
+ if (toolchanges.length) {
+ $('#runToolsBtn').show().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').show().attr('disabled', true);
+ }
+ // $('#runBtn').show().attr('disabled', true);
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
@@ -194,7 +228,13 @@ function setControlBar(val, status) {
}
$('.estop').show()
} else if (val == 6) { // Firmware Upgrade State
- $('#runBtn').hide().attr('disabled', true);
+ if (toolchanges.length) {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ } else {
+ $('#runToolsBtn').hide().attr('disabled', true);
+ $('#runBtn').hide().attr('disabled', true);
+ }
$('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true);
diff --git a/app/js/viewer.js b/app/js/viewer.js
index 2b10453..34bb129 100644
--- a/app/js/viewer.js
+++ b/app/js/viewer.js
@@ -35,6 +35,7 @@ var ground;
containerWidth = window.innerWidth;
containerHeight = window.innerHeight;
+var animationLoopTimeout;
function drawWorkspace(xmin, xmax, ymin, ymax) {
@@ -416,7 +417,7 @@ function animate() {
} // end clearSceneFlag
// Limited FPS https://stackoverflow.com/questions/11285065/limiting-framerate-in-three-js-to-increase-performance-requestanimationframe
- setTimeout(function() {
+ animationLoopTimeout = setTimeout(function() {
requestAnimationFrame(animate);
}, 40);
diff --git a/app/js/websocket.js b/app/js/websocket.js
index 29b7283..f755d8c 100644
--- a/app/js/websocket.js
+++ b/app/js/websocket.js
@@ -20,14 +20,26 @@ $(document).ready(function() {
}
});
-
$("form").submit(function() {
return false;
});
-
-
});
+// endline can be Blank
+function runGcodeSection(startline, endline) {
+ var gcode = editor.getValue()
+ gcodeLines = gcode.split("\n")
+ if (endline) {
+ var newgcode = gcodeLines.slice(startline, endline)
+ } else {
+ var newgcode = gcodeLines.slice(startline)
+ }
+
+ var newGcodeString = newgcode.join("\n").replace(/M6|M06|M006/i, "");
+
+ socket.emit('runJob', newGcodeString);
+}
+
function printLog(string) {
if (document.getElementById("console") !== null) {
if (string.isString) {
@@ -439,12 +451,12 @@ function initSocket() {
socket.on('features', function(data) {
console.log('FEATURES', data)
- for (i=0; i
0) {
+ dropdownTemplate += ` Run Header (lines 1-` + toolchanges[0].lineNum + `)`
+ }
+ for (i = 0; i < toolchanges.length; i++) {
+ var endline = false;
+ if (toolchanges[i + 1]) {
+ endline = toolchanges[i + 1].lineNum
+ }
+ dropdownTemplate += ``
+ dropdownTemplate += ` Run Tool `
+ if (toolchanges[i].toolNum) {
+ dropdownTemplate += toolchanges[i].toolNum + ` `
+ }
+ if (toolchanges[i].toolComment) {
+ dropdownTemplate += toolchanges[i].toolComment + ` `
+ }
+ if (toolchanges[i].sectionComment) {
+ dropdownTemplate += toolchanges[i].sectionComment + ` `
+ }
+ dropdownTemplate += ` from line ` + toolchanges[i].lineNum + ` `
+ dropdownTemplate += ``
+ }
+ $('#toolChangesMenu').html(dropdownTemplate)
+ } else {
+ $('#runBtn').show()
+ $('#runToolsBtn').hide()
+ }
+
};
function simSpeed() {
@@ -332,4 +369,4 @@ function simstop() {
editor.gotoLine(0)
cone.visible = false;
clearSceneFlag = true;
-}
+}
\ No newline at end of file
diff --git a/app/lib/3dview/workers/litegcodeviewer.js b/app/lib/3dview/workers/litegcodeviewer.js
index 81412b5..0836a90 100644
--- a/app/lib/3dview/workers/litegcodeviewer.js
+++ b/app/lib/3dview/workers/litegcodeviewer.js
@@ -22,8 +22,10 @@ var lastLine = {
z: 0,
e: 0,
f: 0,
+ t: false,
feedrate: null,
- extruding: false
+ extruding: false,
+ tool: false
};
function openGCodeFromText(gcode) {
@@ -33,44 +35,46 @@ function openGCodeFromText(gcode) {
console.log(parsedData)
var geometry = new THREE.BufferGeometry();
- var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );
+ var material = new THREE.LineBasicMaterial({
+ vertexColors: THREE.VertexColors
+ });
var positions = [];
- var colors = [];
+ var colors = [];
- for (i=0; i< parsedData.lines.length; i++) {
+ for (i = 0; i < parsedData.lines.length; i++) {
if (!parsedData.lines[i].args.isFake) {
var x = parsedData.lines[i].p2.x;
- var y = parsedData.lines[i].p2.y;
- var z = parsedData.lines[i].p2.z;
- positions.push( x, y, z );
+ var y = parsedData.lines[i].p2.y;
+ var z = parsedData.lines[i].p2.z;
+ positions.push(x, y, z);
if (parsedData.lines[i].p2.g0) {
- colors.push( 0 );
- colors.push( 200 );
- colors.push( 0 );
+ colors.push(0);
+ colors.push(200);
+ colors.push(0);
} else if (parsedData.lines[i].p2.g1) {
- colors.push( 200 );
- colors.push( 0 );
- colors.push( 0 );
+ colors.push(200);
+ colors.push(0);
+ colors.push(0);
} else if (parsedData.lines[i].p2.g2) {
- colors.push( 0 );
- colors.push( 0 );
- colors.push( 200 );
+ colors.push(0);
+ colors.push(0);
+ colors.push(200);
} else {
- colors.push( 200 );
- colors.push( 0 );
- colors.push( 200 );
+ colors.push(200);
+ colors.push(0);
+ colors.push(200);
}
}
}
- geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
- geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+ geometry.addAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
+ geometry.addAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
- geometry.computeBoundingSphere();
+ geometry.computeBoundingSphere();
- var line = new THREE.Line( geometry, material );
+ var line = new THREE.Line(geometry, material);
line.geometry.computeBoundingBox();
var box = line.geometry.boundingBox.clone();
line.userData.lines = parsedData.lines
@@ -202,6 +206,17 @@ GCodeParser = function(handlers, modecmdhandlers) {
// use feedrate from prior lines
args.svalue = this.lastsvalue;
}
+
+ if (args.text.match(/T([\d.]+)/i)) {
+ console.log("New Tool: ", args.text)
+ // we have a new S-Value
+ var tool = parseFloat(RegExp.$1);
+ args.tool = tool;
+ this.lasttool = tool;
+ } else {
+ // use tool from prior lines
+ args.tool = this.lasttool;
+ }
//console.log("about to call handler. args:", args, "info:", info, "this:", this);
return handler(args, info, this);
} else {
@@ -245,18 +260,20 @@ GCodeParser = function(handlers, modecmdhandlers) {
colorG1 = 0xcc0000,
colorG2 = 0x0000cc,
createObjectFromGCode = function(gcode) {
- // console.log(gcode)
+ // console.log(gcode)
- // Reset Starting Point
- lastLine = {
- x: 0,
- y: 0,
- z: 0,
- e: 0,
- f: 0,
- feedrate: null,
- extruding: false
- };
+ // Reset Starting Point
+ lastLine = {
+ x: 0,
+ y: 0,
+ z: 0,
+ e: 0,
+ f: 0,
+ s: 0,
+ t: false,
+ feedrate: null,
+ extruding: false
+ };
setUnits = function(units) {
@@ -588,13 +605,13 @@ GCodeParser = function(handlers, modecmdhandlers) {
// end of if p2.arc
// console.log( p2.threeObjArc.userData.points)
-console.log(threeObjArc.userData.points.length)
+ console.log(threeObjArc.userData.points.length)
- for (i=0; i",