kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
v1.0.90
rodzic
9a26d6e72f
commit
f8d90c67d1
|
@ -160,6 +160,7 @@
|
|||
<li class=""><a href="#" onclick="socket.emit('opencam', true);">Open browser to https://cam.openbuilds.com</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button id="runBtn" class="ribbon-button" onclick="socket.emit('runJob', editor.getValue());">
|
||||
<span class="icon">
|
||||
<i class="fas fa-play"></i>
|
||||
|
@ -184,6 +185,12 @@
|
|||
</span>
|
||||
<span class="caption">Stop<br>Job</span>
|
||||
</button>
|
||||
<button id="chkSize" class="ribbon-button">
|
||||
<span class="icon">
|
||||
<i class="far fa-square"></i>
|
||||
</span>
|
||||
<span class="caption">Check<br>Size</span>
|
||||
</button>
|
||||
<div>
|
||||
<button id="toolBtn" class="ribbon-button dropdown-toggle">
|
||||
<span class="icon">
|
||||
|
@ -272,7 +279,7 @@
|
|||
|
||||
<div id="manualControlPanel">
|
||||
<center>
|
||||
<div id="jogcontrols">
|
||||
<div id="jogcontrols" class="mt-1">
|
||||
<div class="row flex-justify-center flex-align-center" style="width: 100%;">
|
||||
<div class="cell">
|
||||
<table class="drotable">
|
||||
|
@ -370,6 +377,7 @@
|
|||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="cell">
|
||||
|
@ -489,7 +497,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div id="controlLogs">
|
||||
<div id="controlLogs" class="mt-1">
|
||||
|
||||
<nav data-role="ribbonmenu">
|
||||
<ul class="tabs-holder">
|
||||
|
@ -516,6 +524,7 @@
|
|||
</div>
|
||||
<div class="section" id="tab-two">
|
||||
<div id="editor"></div>
|
||||
|
||||
<div class="fixed-bottom m-3 mb-9">
|
||||
<!-- <form class="inline-form"> -->
|
||||
<button title="Find and Replace" class="button dark" onclick="editor.execCommand('replace')"><i class="fas fa-search"></i> Find/Replace</button>
|
||||
|
@ -697,6 +706,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Simulator Context Menu -->
|
||||
<ul class="d-menu context" id="editorContextMenu" data-role="dropdown" data-toggle-element="#context_toggle">
|
||||
<span id="dropdowncontent">
|
||||
<li onclick="runSimFrom();"><a href="#"><i class="fas fa-fighter-jet icon"></i> Simulate from line <span id="linenumber"></span></a>
|
||||
</li>
|
||||
</span>
|
||||
</ul>
|
||||
<!-- -->
|
||||
|
||||
<div id="hiddendivs" style="display:none;">
|
||||
<div class="dialog" id="downloadUpdate" data-role="dialog" data-overlay-click-close="true" data-to-top="true">
|
||||
<div class="dialog-title">Update Ready</div>
|
||||
|
@ -718,6 +736,7 @@
|
|||
|
||||
<!-- Modal Divs -->
|
||||
<div style="display: none;">
|
||||
|
||||
<div class="dialog" data-overlay-click-close="true" data-role="dialog" id="jogWidgetDialog" data-to-top="true">
|
||||
<div class="dialog-title">Jog Widget</div>
|
||||
<div class="dialog-content" style="max-height: calc(100vh - 200px);overflow-y: auto; overflow-x: hidden;">
|
||||
|
|
|
@ -168,6 +168,31 @@ $(document).ready(function() {
|
|||
jog('Z', jogdist, feedrate);
|
||||
})
|
||||
|
||||
$('#chkSize').on('click', function() {
|
||||
var bbox2 = new THREE.Box3().setFromObject(object);
|
||||
console.log('bbox for Draw Bounding Box: ' + object + ' Min X: ', (bbox2.min.x), ' Max X:', (bbox2.max.x), 'Min Y: ', (bbox2.min.y), ' Max Y:', (bbox2.max.y));
|
||||
var feedrate = $('#jograte').val();
|
||||
if (laststatus.machine.firmware.type === 'grbl') {
|
||||
var moves = `
|
||||
$J=G90 X` + (bbox2.min.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
$J=G90 X` + (bbox2.max.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
$J=G90 X` + (bbox2.max.x) + ` Y` + (bbox2.max.y) + ` F` + feedrate + `\n
|
||||
$J=G90 X` + (bbox2.min.x) + ` Y` + (bbox2.max.y) + ` F` + feedrate + `\n
|
||||
$J=G90 X` + (bbox2.min.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
`;
|
||||
} else {
|
||||
var moves = `
|
||||
G90\n
|
||||
G0 X` + (bbox2.min.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
G0 X` + (bbox2.max.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
G0 X` + (bbox2.max.x) + ` Y` + (bbox2.max.y) + ` F` + feedrate + `\n
|
||||
G0 X` + (bbox2.min.x) + ` Y` + (bbox2.max.y) + ` F` + feedrate + `\n
|
||||
G0 X` + (bbox2.min.x) + ` Y` + (bbox2.min.y) + ` F` + feedrate + `\n
|
||||
G90\n`;
|
||||
}
|
||||
socket.emit('runJob', moves);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function jog(dir, dist, feed = null) {
|
||||
|
|
|
@ -22,18 +22,29 @@ $(document).ready(function() {
|
|||
|
||||
}
|
||||
|
||||
// editor.container.addEventListener("contextmenu", function(e) {
|
||||
// console.log("context")
|
||||
// var template = `<h6 class="dropdown-header"><div class="float-left">Line <span id="linenumber"></span>: Options</div><div class="float-right"><button type="button" class="close" aria-label="Close" onclick="$('#editorContextMenu').hide()"><span aria-hidden="true">×</span></button></div></h6><a class="dropdown-item" href="#"><i class="fa fa-fw fa-list-ol" aria-hidden="true"></i> Run queue from here</a>
|
||||
// <a class="dropdown-item" href="#" onclick="ContextLineRun();"><i class="fa fa-fw fa-play" aria-hidden="true"></i> Execute line: <code>` + editor.session.getLine(editor.getSelectionRange().start.row) + `</code></a>
|
||||
// <a class="dropdown-item" href="#" onclick="sim(` + (editor.getSelectionRange().start.row + 1) + `)"><i class="fa fa-fw fa-fighter-jet" aria-hidden="true"></i> Simulate from here</a>`
|
||||
// $("#dropdowncontent").html(template)
|
||||
// // console.log(e);
|
||||
// setposition(e);
|
||||
// e.preventDefault();
|
||||
// $('#linenumber').html((editor.getSelectionRange().start.row + 1));
|
||||
// // alert('success! - rightclicked line ' + (editor.getSelectionRange().start.row + 1));
|
||||
// }, false);
|
||||
|
||||
function setposition(e) {
|
||||
var bodyOffsets = document.body.getBoundingClientRect();
|
||||
tempX = e.pageX //- bodyOffsets.left;
|
||||
tempY = e.pageY;
|
||||
// console.log(tempX);
|
||||
var offset = $("#editorContextMenu").offset();
|
||||
console.log(offset)
|
||||
$("#editorContextMenu").css({
|
||||
display: 'block',
|
||||
left: e.pageX,
|
||||
top: e.pageY
|
||||
});
|
||||
console.log(e.pageX, e.pageY)
|
||||
}
|
||||
|
||||
editor.container.addEventListener("contextmenu", function(e) {
|
||||
console.log("context", e)
|
||||
setposition(e);
|
||||
e.preventDefault();
|
||||
$('#linenumber').html((editor.getSelectionRange().start.row + 1));
|
||||
// alert('success! - rightclicked line ' + (editor.getSelectionRange().start.row + 1));
|
||||
}, false);
|
||||
|
||||
document.addEventListener('keydown', function(evt) {
|
||||
if (evt.which === 123) {
|
||||
|
|
35
app/js/ui.js
35
app/js/ui.js
|
@ -89,6 +89,7 @@ function setConnectBar(val, status) {
|
|||
function setControlBar(val, status) {
|
||||
if (val == 0) { // Not Connected Yet
|
||||
$('#runBtn').hide().attr('disabled', true);
|
||||
$('#chkSize').show().attr('disabled', true);
|
||||
$('#resumeBtn').hide().attr('disabled', true);
|
||||
$('#pauseBtn').hide().attr('disabled', true);
|
||||
$('#stopBtn').hide().attr('disabled', true);
|
||||
|
@ -98,6 +99,7 @@ function setControlBar(val, status) {
|
|||
} 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);
|
||||
} else {
|
||||
$('#runBtn').show().attr('disabled', false);
|
||||
}
|
||||
|
@ -109,6 +111,7 @@ function setControlBar(val, status) {
|
|||
$('.estop').show()
|
||||
} else if (val == 3) { // Busy Streaming GCODE
|
||||
$('#runBtn').hide().attr('disabled', true);
|
||||
$('#chkSize').show().attr('disabled', true);
|
||||
$('#resumeBtn').hide().attr('disabled', true);
|
||||
$('#pauseBtn').show().attr('disabled', false);
|
||||
$('#stopBtn').show().attr('disabled', false);
|
||||
|
@ -117,6 +120,7 @@ function setControlBar(val, status) {
|
|||
$('.estop').show()
|
||||
} else if (val == 4) { // Paused
|
||||
$('#runBtn').hide().attr('disabled', true);
|
||||
$('#chkSize').show().attr('disabled', true);
|
||||
$('#resumeBtn').show().attr('disabled', false);
|
||||
$('#pauseBtn').hide().attr('disabled', true);
|
||||
$('#stopBtn').show().attr('disabled', false);
|
||||
|
@ -125,6 +129,7 @@ function setControlBar(val, status) {
|
|||
$('.estop').show()
|
||||
} else if (val == 5) { // Alarm State
|
||||
$('#runBtn').show().attr('disabled', true);
|
||||
$('#chkSize').show().attr('disabled', true);
|
||||
$('#resumeBtn').hide().attr('disabled', true);
|
||||
$('#pauseBtn').hide().attr('disabled', true);
|
||||
$('#stopBtn').show().attr('disabled', false);
|
||||
|
@ -139,9 +144,9 @@ function setJogPanel(val, status) {
|
|||
// Show panel and resize editor
|
||||
$("#svgview").css('background-color', '#f5f6f7');
|
||||
// $("#jogcontrols").slideUp(20);
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
|
||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||
if (editor) {
|
||||
editor.resize()
|
||||
|
@ -162,9 +167,9 @@ function setJogPanel(val, status) {
|
|||
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
|
||||
// Show panel and resize editor
|
||||
$("#svgview").css('background-color', '#ffffff');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
|
||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||
if (editor) {
|
||||
editor.resize()
|
||||
|
@ -184,9 +189,9 @@ function setJogPanel(val, status) {
|
|||
} else if (val == 3) { // Busy Streaming GCODE
|
||||
// Show panel and resize editor
|
||||
$("#svgview").css('background-color', '#f5f6f7');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
|
||||
if (editor) {
|
||||
editor.resize()
|
||||
}
|
||||
|
@ -203,9 +208,9 @@ function setJogPanel(val, status) {
|
|||
} else if (val == 4) { // Paused
|
||||
// Show panel and resize editor
|
||||
$("#svgview").css('background-color', '#f5f6f7');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
|
||||
if (editor) {
|
||||
editor.resize()
|
||||
}
|
||||
|
@ -221,9 +226,9 @@ function setJogPanel(val, status) {
|
|||
} else if (val == 5) { // Alarm State
|
||||
// Show panel and resize editor
|
||||
$("#svgview").css('background-color', '#f5f6f7');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||
$("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#console").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
|
||||
$("#renderArea").css('height', 'calc(' + 100 + 'vh - ' + 448 + 'px)');
|
||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||
if (editor) {
|
||||
editor.resize()
|
||||
|
|
|
@ -173,7 +173,6 @@ function initSocket() {
|
|||
if (laststatus) {
|
||||
if (laststatus.comms.connectionStatus == 3) {
|
||||
editor.gotoLine(parseInt(data[1]) - parseInt(data[0]));
|
||||
update3Dprogress(parseInt(data[1]) - parseInt(data[0]));
|
||||
}
|
||||
}
|
||||
$('#gcodesent').html("Queue: " + parseInt(data[0]));
|
||||
|
|
|
@ -25,6 +25,7 @@ worker.addEventListener('message', function(e) {
|
|||
}, false);
|
||||
|
||||
function parseGcodeInWebWorker(gcode) {
|
||||
simstop()
|
||||
scene.remove(object)
|
||||
object = false;
|
||||
worker.postMessage({
|
||||
|
@ -38,6 +39,11 @@ function simSpeed() {
|
|||
$('#simspeedval').text(timefactor);
|
||||
}
|
||||
|
||||
function runSimFrom() {
|
||||
$('#gcodeviewertab').click()
|
||||
sim(editor.getSelectionRange().start.row + 1);
|
||||
}
|
||||
|
||||
function sim(startindex) {
|
||||
if (typeof(object) == 'undefined' || !scene.getObjectByName('gcodeobject')) {
|
||||
console.log('No Gcode in Preview yet')
|
||||
|
@ -166,10 +172,11 @@ function sim(startindex) {
|
|||
}
|
||||
|
||||
function simstop() {
|
||||
simIdx = 0;
|
||||
simRunning = false;
|
||||
$('#runSimBtn').show()
|
||||
$('#stopSimBtn').hide()
|
||||
timefactor = 1;
|
||||
// timefactor = 1;
|
||||
$('#simspeedval').text(timefactor);
|
||||
editor.gotoLine(0)
|
||||
cone.visible = false;
|
||||
|
|
4
index.js
4
index.js
|
@ -2037,8 +2037,8 @@ if (isElectron()) {
|
|||
function createJogWindow() {
|
||||
// Create the browser window.
|
||||
jogWindow = new BrowserWindow({
|
||||
width: 660,
|
||||
height: 730,
|
||||
width: 850,
|
||||
height: 850,
|
||||
fullscreen: false,
|
||||
center: true,
|
||||
resizable: true,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "OpenBuildsMachineDriver",
|
||||
"version": "1.0.89",
|
||||
"version": "1.0.91",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "Machine Interface Driver for OpenBuilds",
|
||||
"author": "github.com/openbuilds <webmaster@openbuilds.com>",
|
||||
|
|
Ładowanie…
Reference in New Issue