pull/110/head
openbuilds-engineer 2019-09-03 20:36:09 +02:00
rodzic 7c7b278c99
commit 543a5324e9
10 zmienionych plików z 1452 dodań i 1201 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -121,11 +121,10 @@ function loadFile(f) {
// if (f.name.match(/.gcode$/i)) { // if (f.name.match(/.gcode$/i)) {
r.readAsText(f); r.readAsText(f);
r.onload = function(event) { r.onload = function(event) {
// cleanupThree();
// gcode = this.result;
editor.session.setValue(this.result); editor.session.setValue(this.result);
parseGcodeInWebWorker(this.result)
printLog('<span class="fg-red">[ GCODE Parser ]</span><span class="fg-green"> GCODE File Loaded, please wait while we render a preview... </span>'); printLog('<span class="fg-red">[ GCODE Parser ]</span><span class="fg-green"> GCODE File Loaded, please wait while we render a preview... </span>');
parseGcodeInWebWorker(this.result)
}; };
// } // }
} }

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -109,7 +109,13 @@ function setConnectBar(val, status) {
// Toolbar with play/pause/stop // Toolbar with play/pause/stop
function setControlBar(val, status) { function setControlBar(val, status) {
if (val == 0) { // Not Connected Yet 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); $('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true); $('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true); $('#pauseBtn').hide().attr('disabled', true);
@ -127,10 +133,19 @@ function setControlBar(val, status) {
$('.estop').hide() $('.estop').hide()
} else if (val == 1 || val == 2) { // Connected, but not Playing yet } else if (val == 1 || val == 2) { // Connected, but not Playing yet
if (typeof ace !== 'undefined') { if (typeof ace !== 'undefined') {
$('#runBtn').show().attr('disabled', editor.session.getLength() < 2); if (toolchanges.length) {
$('#chkSize').show().attr('disabled', editor.session.getLength() < 2); $('#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 { } else {
$('#runBtn').show().attr('disabled', false); $('#runBtn').show().attr('disabled', false);
$('#runToolsBtn').hide().attr('disabled', false);
} }
$('#resumeBtn').hide().attr('disabled', true); $('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true); $('#pauseBtn').hide().attr('disabled', true);
@ -146,7 +161,13 @@ function setControlBar(val, status) {
} }
$('.estop').show() $('.estop').show()
} else if (val == 3) { // Busy Streaming GCODE } 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); $('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true); $('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').show().attr('disabled', false); $('#pauseBtn').show().attr('disabled', false);
@ -162,7 +183,13 @@ function setControlBar(val, status) {
} }
$('.estop').show() $('.estop').show()
} else if (val == 4) { // Paused } 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); $('#chkSize').show().attr('disabled', true);
$('#resumeBtn').show().attr('disabled', false); $('#resumeBtn').show().attr('disabled', false);
$('#pauseBtn').hide().attr('disabled', true); $('#pauseBtn').hide().attr('disabled', true);
@ -178,7 +205,14 @@ function setControlBar(val, status) {
} }
$('.estop').show() $('.estop').show()
} else if (val == 5) { // Alarm State } 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); $('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true); $('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true); $('#pauseBtn').hide().attr('disabled', true);
@ -194,7 +228,13 @@ function setControlBar(val, status) {
} }
$('.estop').show() $('.estop').show()
} else if (val == 6) { // Firmware Upgrade State } 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); $('#chkSize').show().attr('disabled', true);
$('#resumeBtn').hide().attr('disabled', true); $('#resumeBtn').hide().attr('disabled', true);
$('#pauseBtn').hide().attr('disabled', true); $('#pauseBtn').hide().attr('disabled', true);

Wyświetl plik

@ -35,6 +35,7 @@ var ground;
containerWidth = window.innerWidth; containerWidth = window.innerWidth;
containerHeight = window.innerHeight; containerHeight = window.innerHeight;
var animationLoopTimeout;
function drawWorkspace(xmin, xmax, ymin, ymax) { function drawWorkspace(xmin, xmax, ymin, ymax) {
@ -416,7 +417,7 @@ function animate() {
} // end clearSceneFlag } // end clearSceneFlag
// Limited FPS https://stackoverflow.com/questions/11285065/limiting-framerate-in-three-js-to-increase-performance-requestanimationframe // Limited FPS https://stackoverflow.com/questions/11285065/limiting-framerate-in-three-js-to-increase-performance-requestanimationframe
setTimeout(function() { animationLoopTimeout = setTimeout(function() {
requestAnimationFrame(animate); requestAnimationFrame(animate);
}, 40); }, 40);

Wyświetl plik

@ -20,14 +20,26 @@ $(document).ready(function() {
} }
}); });
$("form").submit(function() { $("form").submit(function() {
return false; 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) { function printLog(string) {
if (document.getElementById("console") !== null) { if (document.getElementById("console") !== null) {
if (string.isString) { if (string.isString) {
@ -439,12 +451,12 @@ function initSocket() {
socket.on('features', function(data) { socket.on('features', function(data) {
console.log('FEATURES', data) console.log('FEATURES', data)
for (i=0; i<data.length; i++) { for (i = 0; i < data.length; i++) {
switch(data[i]) { switch (data[i]) {
case 'Q': case 'Q':
console.log('SPINDLE_IS_SERVO Enabled') console.log('SPINDLE_IS_SERVO Enabled')
$('#enServo').removeClass('alert').addClass('success').html('ON') $('#enServo').removeClass('alert').addClass('success').html('ON')
$(".servo-active").show() $(".servo-active").show()
break; break;
case 'V': // Variable spindle enabled case 'V': // Variable spindle enabled
console.log('Variable spindle enabled') console.log('Variable spindle enabled')
@ -679,4 +691,4 @@ function friendlyPort(i) {
function escapeHTML(html) { function escapeHTML(html) {
return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML;
} }

Wyświetl plik

@ -1,4 +1,4 @@
var object var object;
var draw, line, timefactor = 1, var draw, line, timefactor = 1,
object, simRunning = false; object, simRunning = false;
@ -73,6 +73,43 @@ function parseGcodeInWebWorker(gcode) {
$('#3dviewicon').addClass('fa-pulse') $('#3dviewicon').addClass('fa-pulse')
$('#3dviewlabel').html(' 3D View (rendering, please wait...)') $('#3dviewlabel').html(' 3D View (rendering, please wait...)')
// toolChanges
toolchanges = setupToolChanges(gcode);
if (toolchanges.length) {
$('#runBtn').hide()
$('#runToolsBtn').show()
$('#toolChangesMenu').empty();
var dropdownTemplate = ``;
if (toolchanges[0].lineNum > 0) {
dropdownTemplate += `<li onclick="runGcodeSection(` + 0 + `,` + toolchanges[0].lineNum + `)"><a href="#" onclick=""><i class="fas fa-play"></i> Run Header (lines 1-` + toolchanges[0].lineNum + `)</a></li>`
}
for (i = 0; i < toolchanges.length; i++) {
var endline = false;
if (toolchanges[i + 1]) {
endline = toolchanges[i + 1].lineNum
}
dropdownTemplate += `<li onclick="runGcodeSection(` + toolchanges[i].lineNum + `,` + endline + `)">`
dropdownTemplate += `<a href="#" onclick=""><i class="fas fa-play"></i> 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 += `</a></li>`
}
$('#toolChangesMenu').html(dropdownTemplate)
} else {
$('#runBtn').show()
$('#runToolsBtn').hide()
}
}; };
function simSpeed() { function simSpeed() {
@ -332,4 +369,4 @@ function simstop() {
editor.gotoLine(0) editor.gotoLine(0)
cone.visible = false; cone.visible = false;
clearSceneFlag = true; clearSceneFlag = true;
} }

Wyświetl plik

@ -22,8 +22,10 @@ var lastLine = {
z: 0, z: 0,
e: 0, e: 0,
f: 0, f: 0,
t: false,
feedrate: null, feedrate: null,
extruding: false extruding: false,
tool: false
}; };
function openGCodeFromText(gcode) { function openGCodeFromText(gcode) {
@ -33,44 +35,46 @@ function openGCodeFromText(gcode) {
console.log(parsedData) console.log(parsedData)
var geometry = new THREE.BufferGeometry(); var geometry = new THREE.BufferGeometry();
var material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } ); var material = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors
});
var positions = []; 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) { if (!parsedData.lines[i].args.isFake) {
var x = parsedData.lines[i].p2.x; var x = parsedData.lines[i].p2.x;
var y = parsedData.lines[i].p2.y; var y = parsedData.lines[i].p2.y;
var z = parsedData.lines[i].p2.z; var z = parsedData.lines[i].p2.z;
positions.push( x, y, z ); positions.push(x, y, z);
if (parsedData.lines[i].p2.g0) { if (parsedData.lines[i].p2.g0) {
colors.push( 0 ); colors.push(0);
colors.push( 200 ); colors.push(200);
colors.push( 0 ); colors.push(0);
} else if (parsedData.lines[i].p2.g1) { } else if (parsedData.lines[i].p2.g1) {
colors.push( 200 ); colors.push(200);
colors.push( 0 ); colors.push(0);
colors.push( 0 ); colors.push(0);
} else if (parsedData.lines[i].p2.g2) { } else if (parsedData.lines[i].p2.g2) {
colors.push( 0 ); colors.push(0);
colors.push( 0 ); colors.push(0);
colors.push( 200 ); colors.push(200);
} else { } else {
colors.push( 200 ); colors.push(200);
colors.push( 0 ); colors.push(0);
colors.push( 200 ); colors.push(200);
} }
} }
} }
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) ); geometry.addAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 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(); line.geometry.computeBoundingBox();
var box = line.geometry.boundingBox.clone(); var box = line.geometry.boundingBox.clone();
line.userData.lines = parsedData.lines line.userData.lines = parsedData.lines
@ -202,6 +206,17 @@ GCodeParser = function(handlers, modecmdhandlers) {
// use feedrate from prior lines // use feedrate from prior lines
args.svalue = this.lastsvalue; 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); //console.log("about to call handler. args:", args, "info:", info, "this:", this);
return handler(args, info, this); return handler(args, info, this);
} else { } else {
@ -245,18 +260,20 @@ GCodeParser = function(handlers, modecmdhandlers) {
colorG1 = 0xcc0000, colorG1 = 0xcc0000,
colorG2 = 0x0000cc, colorG2 = 0x0000cc,
createObjectFromGCode = function(gcode) { createObjectFromGCode = function(gcode) {
// console.log(gcode) // console.log(gcode)
// Reset Starting Point // Reset Starting Point
lastLine = { lastLine = {
x: 0, x: 0,
y: 0, y: 0,
z: 0, z: 0,
e: 0, e: 0,
f: 0, f: 0,
feedrate: null, s: 0,
extruding: false t: false,
}; feedrate: null,
extruding: false
};
setUnits = function(units) { setUnits = function(units) {
@ -588,13 +605,13 @@ GCodeParser = function(handlers, modecmdhandlers) {
// end of if p2.arc // end of if p2.arc
// console.log( p2.threeObjArc.userData.points) // console.log( p2.threeObjArc.userData.points)
console.log(threeObjArc.userData.points.length) console.log(threeObjArc.userData.points.length)
for (i=0; i<threeObjArc.userData.points.length; i++) { for (i = 0; i < threeObjArc.userData.points.length; i++) {
var p2 = { var p2 = {
x: threeObjArc.userData.points[i].x, x: threeObjArc.userData.points[i].x,
y:threeObjArc.userData.points[i].y, y: threeObjArc.userData.points[i].y,
z:threeObjArc.userData.points[i].z, z: threeObjArc.userData.points[i].z,
e: p2.e, e: p2.e,
f: p2.f, f: p2.f,
g2: true g2: true
@ -730,6 +747,7 @@ console.log(threeObjArc.userData.points.length)
e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e, e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e,
f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f, f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f,
s: args.s !== undefined ? cofg.absolute(lastLine.s, args.s) : lastLine.s, s: args.s !== undefined ? cofg.absolute(lastLine.s, args.s) : lastLine.s,
t: args.t !== undefined ? cofg.absolute(lastLine.t, args.t) : lastLine.t,
}; };
newLine.g0 = true; newLine.g0 = true;
//cofg.newLayer(newLine); //cofg.newLayer(newLine);
@ -752,6 +770,7 @@ console.log(threeObjArc.userData.points.length)
e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e, e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e,
f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f, f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f,
s: args.s !== undefined ? cofg.absolute(lastLine.s, args.s) : lastLine.s, s: args.s !== undefined ? cofg.absolute(lastLine.s, args.s) : lastLine.s,
t: args.t !== undefined ? cofg.absolute(lastLine.t, args.t) : lastLine.t,
}; };
/* layer change detection is or made by watching Z, it's made by /* layer change detection is or made by watching Z, it's made by
watching when we extrude at a new Z position */ watching when we extrude at a new Z position */
@ -774,6 +793,8 @@ console.log(threeObjArc.userData.points.length)
z: args.z !== undefined ? cofg.absolute(lastLine.z, args.z) + cofg.offsetG92.z : lastLine.z, z: args.z !== undefined ? cofg.absolute(lastLine.z, args.z) + cofg.offsetG92.z : lastLine.z,
e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e, e: args.e !== undefined ? cofg.absolute(lastLine.e, args.e) + cofg.offsetG92.e : lastLine.e,
f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f, f: args.f !== undefined ? cofg.absolute(lastLine.f, args.f) : lastLine.f,
s: args.s !== undefined ? cofg.absolute(lastLine.s, args.s) : lastLine.s,
t: args.t !== undefined ? cofg.absolute(lastLine.t, args.t) : lastLine.t,
arci: args.i !== undefined ? cofg.ijkabsolute(lastLine.x, args.i) : lastLine.x, arci: args.i !== undefined ? cofg.ijkabsolute(lastLine.x, args.i) : lastLine.x,
arcj: args.j !== undefined ? cofg.ijkabsolute(lastLine.y, args.j) : lastLine.y, arcj: args.j !== undefined ? cofg.ijkabsolute(lastLine.y, args.j) : lastLine.y,
arck: args.k !== undefined ? cofg.ijkabsolute(lastLine.z, args.k) : lastLine.z, arck: args.k !== undefined ? cofg.ijkabsolute(lastLine.z, args.k) : lastLine.z,
@ -925,6 +946,7 @@ console.log(threeObjArc.userData.points.length)
}, },
// No-op modal macros that do not affect the viewer // No-op modal macros that do not affect the viewer
M6: function(args) {}, // Pause for Toolchange
M07: function() {}, // Coolant on (mist) M07: function() {}, // Coolant on (mist)
M08: function() {}, // Coolant on (flood) M08: function() {}, // Coolant on (flood)
M09: function() {}, // Coolant off M09: function() {}, // Coolant off
@ -978,4 +1000,4 @@ console.log(threeObjArc.userData.points.length)
} }
return data; return data;
} // end of createObjectFromGCode() } // end of createObjectFromGCode()

Wyświetl plik

@ -229,7 +229,13 @@ var status = {
realFeed: 0, // realFeed: 0, //
realSpindle: 0 // realSpindle: 0 //
}, },
// status.machine.probe. //
tool: {
nexttool: {
number: 0,
line: ""
}
},
probe: { probe: {
x: 0.00, x: 0.00,
y: 0.00, y: 0.00,
@ -1620,6 +1626,11 @@ function readFile(path) {
function machineSend(gcode) { function machineSend(gcode) {
// console.log("SENDING: " + gcode) // console.log("SENDING: " + gcode)
if (port.isOpen) { if (port.isOpen) {
if (gcode.match(/T([\d.]+)/i)) {
var tool = parseFloat(RegExp.$1);
status.machine.tool.nexttool.number = tool
status.machine.tool.nexttool.line = gcode
}
var queueLeft = (gcodeQueue.length - queuePointer) var queueLeft = (gcodeQueue.length - queuePointer)
var queueTotal = gcodeQueue.length var queueTotal = gcodeQueue.length
// console.log("Q: " + queueLeft) // console.log("Q: " + queueLeft)

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "OpenBuildsCONTROL", "name": "OpenBuildsCONTROL",
"version": "1.0.185", "version": "1.0.186-beta",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"description": "Machine Interface Driver for OpenBuilds", "description": "Machine Interface Driver for OpenBuilds",
"author": "github.com/openbuilds <webmaster@openbuilds.com>", "author": "github.com/openbuilds <webmaster@openbuilds.com>",