diff --git a/app/js/jog.js b/app/js/jog.js
index cb2fac7..983fb81 100644
--- a/app/js/jog.js
+++ b/app/js/jog.js
@@ -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) {
diff --git a/app/js/main.js b/app/js/main.js
index 669fe0f..dcd87d9 100644
--- a/app/js/main.js
+++ b/app/js/main.js
@@ -22,18 +22,29 @@ $(document).ready(function() {
}
- // editor.container.addEventListener("contextmenu", function(e) {
- // console.log("context")
- // var template = `
Run queue from here
- //
Execute line: ` + editor.session.getLine(editor.getSelectionRange().start.row) + `
- //
Simulate from here`
- // $("#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) {
diff --git a/app/js/ui.js b/app/js/ui.js
index 142223a..1545fba 100644
--- a/app/js/ui.js
+++ b/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()
diff --git a/app/js/websocket.js b/app/js/websocket.js
index ff6df6d..55f76ab 100644
--- a/app/js/websocket.js
+++ b/app/js/websocket.js
@@ -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]));
diff --git a/app/lib/3dview/3dview.js b/app/lib/3dview/3dview.js
index 1cb1463..79fa167 100644
--- a/app/lib/3dview/3dview.js
+++ b/app/lib/3dview/3dview.js
@@ -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;
diff --git a/index.js b/index.js
index ae0bcc5..7de9e01 100644
--- a/index.js
+++ b/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,
diff --git a/package.json b/package.json
index 6c394c6..b0076ac 100644
--- a/package.json
+++ b/package.json
@@ -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
",