kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
beta 1.0.186
rodzic
7c7b278c99
commit
543a5324e9
|
@ -156,7 +156,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div>
|
<div>
|
||||||
<button id="camBtn" class="ribbon-button dropdown-toggle" title="Open a GCODE file">
|
<button id="openGcodeBtn" class="ribbon-button dropdown-toggle" title="Open a GCODE file">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<span class="far fa-folder-open fg-amber"></span>
|
<span class="far fa-folder-open fg-amber"></span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -168,12 +168,25 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button id="runBtn" class="ribbon-button" onclick="socket.emit('runJob', editor.getValue());">
|
<button id="runBtn" class="ribbon-button" onclick="socket.emit('runJob', editor.getValue());" title="Run a Job">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fas fa-play"></i>
|
<i class="fas fa-play"></i>
|
||||||
</span>
|
</span>
|
||||||
<span class="caption">Run<br>Job</span>
|
<span class="caption">Run<br>Job</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button id="runToolsBtn" class="ribbon-button dropdown-toggle" title="Run a Job with Toolchanges">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="fas fa-play"></i>
|
||||||
|
</span>
|
||||||
|
<span class="caption">Run<br>Job</span>
|
||||||
|
</button>
|
||||||
|
<ul class="ribbon-dropdown" data-role="dropdown" data-duration="100" id="toolChangesMenu">
|
||||||
|
<li class=""><a href="#" onclick="socket.emit('opencam', true);"><i class="fas fa-link fa-fw"></i> Open browser to https://cam.openbuilds.com</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button id="resumeBtn" class="ribbon-button" onclick="socket.emit('resume', true)">
|
<button id="resumeBtn" class="ribbon-button" onclick="socket.emit('resume', true)">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fas fa-play"></i>
|
<i class="fas fa-play"></i>
|
||||||
|
@ -656,10 +669,12 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan='5'>
|
<td colspan='5'>
|
||||||
<div id="jogratemmdiv">
|
<div id="jogratemmdiv">
|
||||||
<input id="jograte" type="number" min="100" max="10000" step="500" placeholder="5000" data-role="input" data-prepend="Jog:" data-append="mm/min" data-clear-button="false" value="5000" style="text-align: right;" data-editable="true" />
|
<input id="jograte" type="number" min="100" max="10000" step="500" placeholder="5000" data-role="input" data-prepend="Jog:" data-append="mm/min" data-clear-button="false" value="5000" style="text-align: right;"
|
||||||
|
data-editable="true" />
|
||||||
</div>
|
</div>
|
||||||
<div id="jograteinchdiv">
|
<div id="jograteinchdiv">
|
||||||
<input id="jograteinch" type="number" min="1" max="5000" step="10" placeholder="196" data-role="input" data-prepend="Jog:" data-append="in/min" data-clear-button="false" value="196" style="text-align: right;" data-editable="true" />
|
<input id="jograteinch" type="number" min="1" max="5000" step="10" placeholder="196" data-role="input" data-prepend="Jog:" data-append="in/min" data-clear-button="false" value="196" style="text-align: right;"
|
||||||
|
data-editable="true" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -668,14 +683,14 @@
|
||||||
|
|
||||||
<div class="cell border-left bd-lightGray" id="frocell">
|
<div class="cell border-left bd-lightGray" id="frocell">
|
||||||
<button class="button light mini mb-1" onclick="feedOverride(100);">reset</button>
|
<button class="button light mini mb-1" onclick="feedOverride(100);">reset</button>
|
||||||
<input id="fro" data-on-stop="feedOverride(arguments[0])" data-role="slider" data-accuracy="5" data-vertical="true" data-size="190" data-accuracy="1" data-min="10" data-max="200" data-value="100" data-hint="true" data-hint-always="true" data-hint-position="bottom"
|
<input id="fro" data-on-stop="feedOverride(arguments[0])" data-role="slider" data-accuracy="5" data-vertical="true" data-size="190" data-accuracy="1" data-min="10" data-max="200" data-value="100" data-hint="true"
|
||||||
data-hint-mask="Feed: $1%" data-cls-hint="bg-light
|
data-hint-always="true" data-hint-position="bottom" data-hint-mask="Feed: $1%" data-cls-hint="bg-light
|
||||||
fg-dark shadow-1" data-cls-complete="bg-openbuilds">
|
fg-dark shadow-1" data-cls-complete="bg-openbuilds">
|
||||||
</div>
|
</div>
|
||||||
<div class="cell border-left bd-lightGray" id="trocell">
|
<div class="cell border-left bd-lightGray" id="trocell">
|
||||||
<button class="button light mini mb-1" onclick="spindleOverride(100);">reset</button>
|
<button class="button light mini mb-1" onclick="spindleOverride(100);">reset</button>
|
||||||
<input id="tro" data-on-stop="spindleOverride(arguments[0])" data-role="slider" data-accuracy="5" data-vertical="true" data-size="190" data-accuracy="1" data-min="10" data-max="200" data-value="100" data-hint="true" data-hint-always="true" data-hint-position="bottom"
|
<input id="tro" data-on-stop="spindleOverride(arguments[0])" data-role="slider" data-accuracy="5" data-vertical="true" data-size="190" data-accuracy="1" data-min="10" data-max="200" data-value="100" data-hint="true"
|
||||||
data-hint-mask="Tool: $1%" data-cls-hint="bg-light
|
data-hint-always="true" data-hint-position="bottom" data-hint-mask="Tool: $1%" data-cls-hint="bg-light
|
||||||
fg-dark shadow-1" data-cls-complete="bg-openbuilds">
|
fg-dark shadow-1" data-cls-complete="bg-openbuilds">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -697,8 +712,8 @@
|
||||||
<div id="console"></div>
|
<div id="console"></div>
|
||||||
<div class="fixed-bottom m-3 mb-9">
|
<div class="fixed-bottom m-3 mb-9">
|
||||||
<form class="inline-form" id="commandform" autocomplete="off">
|
<form class="inline-form" id="commandform" autocomplete="off">
|
||||||
<input data-prepend=" <i class='fas fa-terminal'></i>" data-role="input" data-clear-button="false" data-role="input" id="command" type="text" autocomplete="on" class=" dark needs-connection" style="width: calc(100vw - 170px);" data-editable="true"
|
<input data-prepend=" <i class='fas fa-terminal'></i>" data-role="input" data-clear-button="false" data-role="input" id="command" type="text" autocomplete="on" class=" dark needs-connection"
|
||||||
/>
|
style="width: calc(100vw - 170px);" data-editable="true" />
|
||||||
<button id="sendCommand" class="button dark needs-connection" type="button" data-role="hint" data-hint-position="top" data-hint-text="Execute Command" data-cls-hint="bg-light fg-dark drop-shadow">
|
<button id="sendCommand" class="button dark needs-connection" type="button" data-role="hint" data-hint-position="top" data-hint-text="Execute Command" data-cls-hint="bg-light fg-dark drop-shadow">
|
||||||
<i class="fa fa-play" style="margin-right: 10px;"></i> Send
|
<i class="fa fa-play" style="margin-right: 10px;"></i> Send
|
||||||
</button>
|
</button>
|
||||||
|
@ -1116,7 +1131,8 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="cell-sm-6">
|
<div class="cell-sm-6">
|
||||||
<small class="text-muted">NB: make sure your spindle is 100% perpendicular (trammed) to your bed, before running a Surfacing operation. Incorrectly trammed spindles will cause uneven machining of the surface, leading to pitting and uneven surface finish
|
<small class="text-muted">NB: make sure your spindle is 100% perpendicular (trammed) to your bed, before running a Surfacing operation. Incorrectly trammed spindles will cause uneven machining of the surface, leading to pitting and
|
||||||
|
uneven surface finish
|
||||||
</small>
|
</small>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
@ -1171,7 +1187,8 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
<center>
|
<center>
|
||||||
<small>You can use your mobile device as an handheld Jog interface. To get started, open a web-browser on your Mobile device and navigate to <br></small><span id="jogip">http://0.0.0.0:3000/jog.html<span><br><small> or scan the QR Code below</small>
|
<small>You can use your mobile device as an handheld Jog interface. To get started, open a web-browser on your Mobile device and navigate to <br></small><span id="jogip">http://0.0.0.0:3000/jog.html<span><br><small> or scan the QR
|
||||||
|
Code below</small>
|
||||||
</center>
|
</center>
|
||||||
<hr class='thin bg-lightGray'>
|
<hr class='thin bg-lightGray'>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1263,5 +1280,7 @@
|
||||||
|
|
||||||
<script type="text/javascript" src="js/grbl-flashing.js"></script>
|
<script type="text/javascript" src="js/grbl-flashing.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="js/toolchange.js"></script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
<!-- -->
|
<!-- -->
|
|
@ -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)
|
||||||
|
|
||||||
};
|
};
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
42
app/js/ui.js
42
app/js/ui.js
|
@ -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
|
||||||
|
if (toolchanges.length) {
|
||||||
|
$('#runToolsBtn').hide().attr('disabled', true);
|
||||||
$('#runBtn').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) {
|
||||||
|
$('#runToolsBtn').show().attr('disabled', editor.session.getLength() < 2);
|
||||||
|
$('#runBtn').hide().attr('disabled', editor.session.getLength() < 2);
|
||||||
$('#chkSize').show().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
|
||||||
|
if (toolchanges.length) {
|
||||||
|
$('#runToolsBtn').hide().attr('disabled', true);
|
||||||
$('#runBtn').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
|
||||||
|
if (toolchanges.length) {
|
||||||
|
$('#runToolsBtn').hide().attr('disabled', true);
|
||||||
$('#runBtn').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
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
// $('#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
|
||||||
|
if (toolchanges.length) {
|
||||||
|
$('#runToolsBtn').hide().attr('disabled', true);
|
||||||
$('#runBtn').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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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,7 +35,9 @@ 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 = [];
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
@ -254,6 +269,8 @@ GCodeParser = function(handlers, modecmdhandlers) {
|
||||||
z: 0,
|
z: 0,
|
||||||
e: 0,
|
e: 0,
|
||||||
f: 0,
|
f: 0,
|
||||||
|
s: 0,
|
||||||
|
t: false,
|
||||||
feedrate: null,
|
feedrate: null,
|
||||||
extruding: false
|
extruding: false
|
||||||
};
|
};
|
||||||
|
@ -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
|
||||||
|
|
13
index.js
13
index.js
|
@ -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)
|
||||||
|
|
|
@ -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>",
|
||||||
|
|
Ładowanie…
Reference in New Issue