kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
v1.0.187
rodzic
543a5324e9
commit
8d34d2f1a8
|
@ -1,3 +1,5 @@
|
||||||
|
v1.0.187: Fixed Workbee1510 profile for new BlackBox wiring video
|
||||||
|
v1.0.186: Fixes for 3D viewer in Inch mode
|
||||||
v1.0.185: Changed wording on Firmware Detection to avoid confusion
|
v1.0.185: Changed wording on Firmware Detection to avoid confusion
|
||||||
v1.0.184: Improved unhandled exceptions to hide unimportant errors from users
|
v1.0.184: Improved unhandled exceptions to hide unimportant errors from users
|
||||||
v1.0.183: Removed LEAD55 and fixed capitalization of LEAD1010, testing Probing with forced G21 before probe
|
v1.0.183: Removed LEAD55 and fixed capitalization of LEAD1010, testing Probing with forced G21 before probe
|
||||||
|
|
|
@ -164,7 +164,7 @@ function selectMachine(type) {
|
||||||
$0: "10", //"Step pulse time, microseconds"
|
$0: "10", //"Step pulse time, microseconds"
|
||||||
$1: "255", //"Step idle delay, milliseconds"
|
$1: "255", //"Step idle delay, milliseconds"
|
||||||
$2: "0", //"Step pulse invert, mask"
|
$2: "0", //"Step pulse invert, mask"
|
||||||
$3: "6", //"Step direction invert, mask"
|
$3: "1", //"Step direction invert, mask"
|
||||||
$4: "1", //"Invert step enable pin, boolean"
|
$4: "1", //"Invert step enable pin, boolean"
|
||||||
$5: "0", //"Invert limit pins, boolean"
|
$5: "0", //"Invert limit pins, boolean"
|
||||||
$6: "0", //"Invert probe pin, boolean"
|
$6: "0", //"Invert probe pin, boolean"
|
||||||
|
@ -837,56 +837,56 @@ function selectMachine(type) {
|
||||||
if (lastSelectedMachine != type) {
|
if (lastSelectedMachine != type) {
|
||||||
if (lastSelectedMachine.substr(0, 4) != type.substr(0, 4)) {
|
if (lastSelectedMachine.substr(0, 4) != type.substr(0, 4)) {
|
||||||
if (customFirmware == "acro") {
|
if (customFirmware == "acro") {
|
||||||
Metro.dialog.create({
|
Metro.dialog.create({
|
||||||
title: "Custom Firmware Required",
|
title: "Custom Firmware Required",
|
||||||
content: `<div>The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine. </div>`,
|
content: `<div>The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine. </div>`,
|
||||||
actions: [{
|
actions: [{
|
||||||
caption: "No Thank you",
|
caption: "No Thank you",
|
||||||
cls: "js-dialog-close",
|
cls: "js-dialog-close",
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
console.log("Do nothing")
|
console.log("Do nothing")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
caption: "Launch the Flashing Wizard",
|
caption: "Launch the Flashing Wizard",
|
||||||
cls: "js-dialog-close success",
|
cls: "js-dialog-close success",
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
populateGrblBuilderToolForm();
|
populateGrblBuilderToolForm();
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$('#grblAxesCount').data('select').val('2axes')
|
$('#grblAxesCount').data('select').val('2axes')
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('This machine needs a custom firmware')
|
console.log('This machine needs a custom firmware')
|
||||||
}
|
}
|
||||||
if (customFirmware == "acropen") {
|
if (customFirmware == "acropen") {
|
||||||
Metro.dialog.create({
|
Metro.dialog.create({
|
||||||
title: "Custom Firmware Required",
|
title: "Custom Firmware Required",
|
||||||
content: `<div>The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine. </div>`,
|
content: `<div>The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine. </div>`,
|
||||||
actions: [{
|
actions: [{
|
||||||
caption: "No Thank you",
|
caption: "No Thank you",
|
||||||
cls: "js-dialog-close",
|
cls: "js-dialog-close",
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
console.log("Do nothing")
|
console.log("Do nothing")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
caption: "Launch the Flashing Wizard",
|
caption: "Launch the Flashing Wizard",
|
||||||
cls: "js-dialog-close success",
|
cls: "js-dialog-close success",
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
populateGrblBuilderToolForm();
|
populateGrblBuilderToolForm();
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$('#grblAxesCount').data('select').val('servo')
|
$('#grblAxesCount').data('select').val('servo')
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('This machine needs a custom firmware')
|
console.log('This machine needs a custom firmware')
|
||||||
}
|
}
|
||||||
|
@ -955,4 +955,4 @@ function setMachineButton(type) {
|
||||||
}
|
}
|
||||||
$('#context_toggle2').html(template);
|
$('#context_toggle2').html(template);
|
||||||
$('#overlayimg').html(`<img src="img/mch/` + overlaytype + `.png" style="max-width:100%; max-height:100%;"/><span onclick="$('#grblTab').click()" style="position: absolute; top: 3px; right:3px; z-index: 1;" class="fas fa-cogs machineicon" style="text-shadow: 2px 2px 4px #cccccc;"></span>`)
|
$('#overlayimg').html(`<img src="img/mch/` + overlaytype + `.png" style="max-width:100%; max-height:100%;"/><span onclick="$('#grblTab').click()" style="position: absolute; top: 3px; right:3px; z-index: 1;" class="fas fa-cogs machineicon" style="text-shadow: 2px 2px 4px #cccccc;"></span>`)
|
||||||
};
|
};
|
|
@ -1,5 +1,21 @@
|
||||||
var toolchanges = [];
|
var toolchanges = [];
|
||||||
|
|
||||||
|
// 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 setupToolChanges(gcode) {
|
function setupToolChanges(gcode) {
|
||||||
// scan gcode for tool change info
|
// scan gcode for tool change info
|
||||||
var fileLines = gcode
|
var fileLines = gcode
|
||||||
|
@ -20,7 +36,14 @@ function setupToolChanges(gcode) {
|
||||||
// T0 ; 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)) {
|
if (line.match(/\(T(\d+)\s+(.*)\)/i) || line.match(/\;T(\d+)\s+(.*)\)/i) || line.match(/\T(\d+)/i)) {
|
||||||
var toolNum = parseInt(RegExp.$1);
|
var toolNum = parseInt(RegExp.$1);
|
||||||
var toolComment = "T" + toolNum + " " + RegExp.$2;
|
if (toolComments[toolNum] && !toolComments[toolNum].toolComment) {
|
||||||
|
// var toolComment = "T" + toolNum + " " + RegExp.$2;
|
||||||
|
} else if (toolComments[toolNum] && toolComments[toolNum].toolComment) {
|
||||||
|
var toolComment = toolComments[toolNum].toolComment + " " + RegExp.$2;
|
||||||
|
} else {
|
||||||
|
var toolComment = "T" + toolNum + " " + RegExp.$2;
|
||||||
|
}
|
||||||
|
// var toolComment = "T" + toolNum + " " + RegExp.$2;
|
||||||
console.log("found tool comment. lineNum:", i, "toolNum:", toolNum, "comment:", toolComment, "line:", line);
|
console.log("found tool comment. lineNum:", i, "toolNum:", toolNum, "comment:", toolComment, "line:", line);
|
||||||
toolComments[toolNum] = {
|
toolComments[toolNum] = {
|
||||||
lineNum: i + 1,
|
lineNum: i + 1,
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
function drawRuler(xmin, xmax, ymin, ymax, inches) {
|
function drawRuler(xmin, xmax, ymin, ymax) {
|
||||||
|
|
||||||
var length1 = 4
|
var length1 = 4
|
||||||
var length5 = 6
|
var length5 = 6
|
||||||
var length10 = 7
|
var length10 = 7
|
||||||
var unitsval = ""
|
var unitsval = ""
|
||||||
if (inches) {
|
console.log(xmin, xmax, ymin, ymax)
|
||||||
xmin = Math.floor(xmin * 0.0393701);
|
|
||||||
xmax = Math.ceil(xmax * 0.0393701);
|
|
||||||
ymin = Math.floor(ymin * 0.0393701);
|
|
||||||
ymax = Math.ceil(ymax * 0.0393701);
|
|
||||||
length1 = 1.4;
|
|
||||||
length5 = 1.6;
|
|
||||||
length10 = 1.7;
|
|
||||||
var unitsval = "in"
|
|
||||||
}
|
|
||||||
var ruler = new THREE.Group();
|
var ruler = new THREE.Group();
|
||||||
var material = new THREE.LineBasicMaterial({
|
var material = new THREE.LineBasicMaterial({
|
||||||
color: 0x888888
|
color: 0x888888
|
||||||
|
@ -92,18 +83,11 @@ function drawRuler(xmin, xmax, ymin, ymax, inches) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var fontsize = 4
|
var fontsize = 4
|
||||||
if (inches) {
|
|
||||||
fontsize = Math.ceil(4 * 0.0393701);
|
|
||||||
}
|
|
||||||
|
|
||||||
var spacing = -10
|
var spacing = -10
|
||||||
if (inches) {
|
|
||||||
spacing = -3;
|
|
||||||
}
|
|
||||||
|
|
||||||
var x = [];
|
var x = [];
|
||||||
var y = [];
|
var y = [];
|
||||||
for (var i = xmin; i <= xmax; i++) {
|
for (var i = xmin; i <= xmax; i++) {
|
||||||
|
|
||||||
if (i % 10 == 0) {
|
if (i % 10 == 0) {
|
||||||
x[i] = this.makeSprite(this.scene, "webgl", {
|
x[i] = this.makeSprite(this.scene, "webgl", {
|
||||||
x: i,
|
x: i,
|
||||||
|
@ -115,9 +99,11 @@ function drawRuler(xmin, xmax, ymin, ymax, inches) {
|
||||||
});
|
});
|
||||||
ruler.add(x[i]);
|
ruler.add(x[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = ymin; i <= ymax; i++) {
|
for (var i = ymin; i <= ymax; i++) {
|
||||||
|
|
||||||
if (i % 10 == 0) {
|
if (i % 10 == 0) {
|
||||||
y[i] = this.makeSprite(this.scene, "webgl", {
|
y[i] = this.makeSprite(this.scene, "webgl", {
|
||||||
x: spacing,
|
x: spacing,
|
||||||
|
@ -143,9 +129,148 @@ function drawRuler(xmin, xmax, ymin, ymax, inches) {
|
||||||
// var line = new THREE.Line(geometry, material);
|
// var line = new THREE.Line(geometry, material);
|
||||||
// ruler.add(line);
|
// ruler.add(line);
|
||||||
|
|
||||||
if (inches) {
|
return (ruler)
|
||||||
ruler.scale.multiplyScalar(25.4);
|
}
|
||||||
|
|
||||||
|
function drawRulerInches(xmin, xmax, ymin, ymax) {
|
||||||
|
|
||||||
|
length1 = 1.4;
|
||||||
|
length5 = 1.6;
|
||||||
|
length10 = 1.7;
|
||||||
|
var unitsval = "in"
|
||||||
|
|
||||||
|
console.log(xmin, xmax, ymin, ymax)
|
||||||
|
|
||||||
|
var ruler = new THREE.Group();
|
||||||
|
var material = new THREE.LineBasicMaterial({
|
||||||
|
color: 0x888888
|
||||||
|
});
|
||||||
|
|
||||||
|
material.opacity = 0.15;
|
||||||
|
|
||||||
|
// x axis
|
||||||
|
for (i = xmin; i <= xmax; i++) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -1, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -length1, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-xmax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = xmin; i <= xmax; i++) {
|
||||||
|
if (i % 5 == 0) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -1, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -length5, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-xmax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = xmin; i <= xmax; i++) {
|
||||||
|
if (i % 10 == 0) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -1, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(i, -length10, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-xmax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// y axis
|
||||||
|
for (i = ymin; i <= ymax; i++) {
|
||||||
|
if (i % 5 == 0) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-1, i, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-length5, i, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-ymax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = ymin; i <= ymax; i++) {
|
||||||
|
if (i % 10 == 0) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-1, i, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-length10, i, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-ymax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = ymin; i <= ymax; i++) {
|
||||||
|
var geometry = new THREE.Geometry();
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-1, i, 0));
|
||||||
|
geometry.vertices.push(new THREE.Vector3(-length1, i, 0));
|
||||||
|
var line = new THREE.Line(geometry, material);
|
||||||
|
// line.translateX(-ymax / 2)
|
||||||
|
// line.translateY(-ymax / 2)
|
||||||
|
ruler.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
fontsize = 10
|
||||||
|
spacing = -10;
|
||||||
|
xmin = Math.floor(xmin * 0.0393701);
|
||||||
|
xmax = Math.ceil(xmax * 0.0393701);
|
||||||
|
ymin = Math.floor(ymin * 0.0393701);
|
||||||
|
ymax = Math.ceil(ymax * 0.0393701);
|
||||||
|
|
||||||
|
console.log(xmin, xmax, ymin, ymax)
|
||||||
|
|
||||||
|
var x = [];
|
||||||
|
var y = [];
|
||||||
|
for (var i = xmin; i <= xmax; i++) {
|
||||||
|
if (i % 1 == 0) {
|
||||||
|
x[i] = this.makeSprite(this.scene, "webgl", {
|
||||||
|
x: i * 25.4,
|
||||||
|
y: spacing,
|
||||||
|
z: 0,
|
||||||
|
text: i + unitsval,
|
||||||
|
color: "#cc0000",
|
||||||
|
size: fontsize / 2.54
|
||||||
|
});
|
||||||
|
ruler.add(x[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = ymin; i <= ymax; i++) {
|
||||||
|
if (i % 1 == 0) {
|
||||||
|
y[i] = this.makeSprite(this.scene, "webgl", {
|
||||||
|
x: spacing,
|
||||||
|
y: i * 25.4,
|
||||||
|
z: 0,
|
||||||
|
text: i + unitsval,
|
||||||
|
color: "#006600",
|
||||||
|
size: fontsize / 2.54
|
||||||
|
});
|
||||||
|
ruler.add(y[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ruler.name = "Rulers"
|
||||||
|
|
||||||
|
// var material = new THREE.LineBasicMaterial({
|
||||||
|
// color: 0x666666
|
||||||
|
// });
|
||||||
|
// material.opacity = 0.15;
|
||||||
|
// var geometry = new THREE.Geometry();
|
||||||
|
// geometry.vertices.push(new THREE.Vector3(xmax, 0, 0));
|
||||||
|
// geometry.vertices.push(new THREE.Vector3(xmax, ymax, 0));
|
||||||
|
// geometry.vertices.push(new THREE.Vector3(0, ymax, 0));
|
||||||
|
// var line = new THREE.Line(geometry, material);
|
||||||
|
// ruler.add(line);
|
||||||
|
|
||||||
|
// ruler.scale.multiplyScalar(25.4);
|
||||||
|
|
||||||
return (ruler)
|
return (ruler)
|
||||||
}
|
}
|
|
@ -140,11 +140,12 @@ function drawWorkspace(xmin, xmax, ymin, ymax) {
|
||||||
workspace.add(cone)
|
workspace.add(cone)
|
||||||
gridsystem.name = "Grid System"
|
gridsystem.name = "Grid System"
|
||||||
workspace.add(gridsystem)
|
workspace.add(gridsystem)
|
||||||
redrawGrid(xmin, xmax, ymin, ymax);
|
redrawGrid(xmin, xmax, ymin, ymax, false);
|
||||||
scene.add(workspace)
|
scene.add(workspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
|
console.log(xmin, xmax, ymin, ymax, inches)
|
||||||
if (inches) {
|
if (inches) {
|
||||||
xmin = Math.floor(xmin * 25.4);
|
xmin = Math.floor(xmin * 25.4);
|
||||||
xmax = Math.ceil(xmax * 25.4);
|
xmax = Math.ceil(xmax * 25.4);
|
||||||
|
@ -171,8 +172,7 @@ function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
|
|
||||||
if (inches) {
|
if (inches) {
|
||||||
var unitsval = "in"
|
var unitsval = "in"
|
||||||
var offset = 5 * 25.4
|
var offset = 5 * 2.54
|
||||||
var size = 5 * 25.4
|
|
||||||
} else {
|
} else {
|
||||||
var unitsval = "mm"
|
var unitsval = "mm"
|
||||||
var offset = 5
|
var offset = 5
|
||||||
|
@ -201,17 +201,6 @@ function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
axesgrp.add(xlbl);
|
axesgrp.add(xlbl);
|
||||||
axesgrp.add(ylbl);
|
axesgrp.add(ylbl);
|
||||||
|
|
||||||
// var unitslabel = this.makeSprite(this.scene, "webgl", {
|
|
||||||
// x: xmin - offset,
|
|
||||||
// y: ymin - offset,
|
|
||||||
// z: 0,
|
|
||||||
// text: unitsval,
|
|
||||||
// color: "#888888",
|
|
||||||
// size: size
|
|
||||||
// });
|
|
||||||
// axesgrp.add(unitslabel);
|
|
||||||
//axesgrp.add(zlbl); Laser don't have Z - but CNCs do
|
|
||||||
|
|
||||||
var materialX = new THREE.LineBasicMaterial({
|
var materialX = new THREE.LineBasicMaterial({
|
||||||
color: 0xcc0000
|
color: 0xcc0000
|
||||||
});
|
});
|
||||||
|
@ -246,11 +235,10 @@ function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
var step10 = 10;
|
var step10 = 10;
|
||||||
var step100 = 100;
|
var step100 = 100;
|
||||||
if (inches) {
|
if (inches) {
|
||||||
step10 = 25.4;
|
step10 = 2.54;
|
||||||
step100 = 254;
|
step100 = 25.4;
|
||||||
}
|
}
|
||||||
|
helper = new THREE.GridHelper(xmin, xmax, ymin, ymax, step10, 0x888888);
|
||||||
helper = new THREE.GridHelper(xmax, ymax, step10, 0x888888);
|
|
||||||
helper.position.y = 0;
|
helper.position.y = 0;
|
||||||
helper.position.x = 0;
|
helper.position.x = 0;
|
||||||
helper.position.z = 0;
|
helper.position.z = 0;
|
||||||
|
@ -259,7 +247,7 @@ function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
helper.receiveShadow = false;
|
helper.receiveShadow = false;
|
||||||
helper.name = "GridHelper10mm"
|
helper.name = "GridHelper10mm"
|
||||||
grid.add(helper);
|
grid.add(helper);
|
||||||
helper = new THREE.GridHelper(xmax, ymax, step100, 0x666666);
|
helper = new THREE.GridHelper(xmin, xmax, ymin, ymax, step100, 0x666666);
|
||||||
helper.position.y = 0;
|
helper.position.y = 0;
|
||||||
helper.position.x = 0;
|
helper.position.x = 0;
|
||||||
helper.position.z = 0;
|
helper.position.z = 0;
|
||||||
|
@ -271,7 +259,11 @@ function redrawGrid(xmin, xmax, ymin, ymax, inches) {
|
||||||
grid.name = "Grid"
|
grid.name = "Grid"
|
||||||
|
|
||||||
gridsystem.children.length = 0
|
gridsystem.children.length = 0
|
||||||
var ruler = drawRuler(xmin, xmax, ymin, ymax, inches)
|
if (inches) {
|
||||||
|
var ruler = drawRulerInches(xmin, xmax, ymin, ymax, inches)
|
||||||
|
} else {
|
||||||
|
var ruler = drawRuler(xmin, xmax, ymin, ymax, inches)
|
||||||
|
}
|
||||||
gridsystem.add(grid);
|
gridsystem.add(grid);
|
||||||
gridsystem.add(ruler);
|
gridsystem.add(ruler);
|
||||||
|
|
||||||
|
|
|
@ -25,20 +25,6 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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) {
|
||||||
|
|
|
@ -24,11 +24,12 @@ function parseGcodeInWebWorker(gcode) {
|
||||||
worker.terminate();
|
worker.terminate();
|
||||||
scene.add(object);
|
scene.add(object);
|
||||||
if (object.userData.inch) {
|
if (object.userData.inch) {
|
||||||
|
// console.log(scaling)
|
||||||
object.scale.x = 25.4
|
object.scale.x = 25.4
|
||||||
object.scale.y = 25.4
|
object.scale.y = 25.4
|
||||||
object.scale.z = 25.4
|
object.scale.z = 25.4
|
||||||
}
|
}
|
||||||
redrawGrid(parseInt(object.userData.bbbox2.min.x), parseInt(object.userData.bbbox2.max.x), parseInt(object.userData.bbbox2.min.y), parseInt(object.userData.bbbox2.max.y), object.userData.inch)
|
redrawGrid(Math.floor(object.userData.bbbox2.min.x), Math.ceil(object.userData.bbbox2.max.x), Math.floor(object.userData.bbbox2.min.y), Math.ceil(object.userData.bbbox2.max.y), object.userData.inch)
|
||||||
// animate();
|
// animate();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (webgl) {
|
if (webgl) {
|
||||||
|
@ -75,40 +76,43 @@ function parseGcodeInWebWorker(gcode) {
|
||||||
|
|
||||||
|
|
||||||
// toolChanges
|
// toolChanges
|
||||||
toolchanges = setupToolChanges(gcode);
|
// toolchanges = setupToolChanges(gcode);
|
||||||
|
//
|
||||||
if (toolchanges.length) {
|
// if (toolchanges.length) {
|
||||||
$('#runBtn').hide()
|
// $('#runBtn').hide()
|
||||||
$('#runToolsBtn').show()
|
// $('#runToolsBtn').show()
|
||||||
$('#toolChangesMenu').empty();
|
// $('#toolChangesMenu').empty();
|
||||||
var dropdownTemplate = ``;
|
// var dropdownTemplate = ``;
|
||||||
if (toolchanges[0].lineNum > 0) {
|
// 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>`
|
// dropdownTemplate += `<li onclick="runGcodeSection(` + 0 + `,` + toolchanges[0].lineNum + `)"><a href="#" onclick=""><i class="fas fa-play"></i> Run Complete Job</a></li>`
|
||||||
}
|
// dropdownTemplate += `<li class="divider"></li>`
|
||||||
for (i = 0; i < toolchanges.length; i++) {
|
// 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>`
|
||||||
var endline = false;
|
//
|
||||||
if (toolchanges[i + 1]) {
|
// }
|
||||||
endline = toolchanges[i + 1].lineNum
|
// for (i = 0; i < toolchanges.length; i++) {
|
||||||
}
|
// var endline = false;
|
||||||
dropdownTemplate += `<li onclick="runGcodeSection(` + toolchanges[i].lineNum + `,` + endline + `)">`
|
// if (toolchanges[i + 1]) {
|
||||||
dropdownTemplate += `<a href="#" onclick=""><i class="fas fa-play"></i> Run Tool `
|
// endline = toolchanges[i + 1].lineNum
|
||||||
if (toolchanges[i].toolNum) {
|
// }
|
||||||
dropdownTemplate += toolchanges[i].toolNum + ` `
|
// dropdownTemplate += `<li onclick="runGcodeSection(` + toolchanges[i].lineNum + `,` + endline + `)">`
|
||||||
}
|
// dropdownTemplate += `<a href="#" onclick=""><i class="fas fa-play"></i> Run Tool `
|
||||||
if (toolchanges[i].toolComment) {
|
// if (toolchanges[i].toolNum) {
|
||||||
dropdownTemplate += toolchanges[i].toolComment + ` `
|
// dropdownTemplate += toolchanges[i].toolNum + ` `
|
||||||
}
|
// }
|
||||||
if (toolchanges[i].sectionComment) {
|
// dropdownTemplate += ` from line ` + (toolchanges[i].lineNum + 1) + ` `
|
||||||
dropdownTemplate += toolchanges[i].sectionComment + ` `
|
// if (toolchanges[i].toolComment) {
|
||||||
}
|
// dropdownTemplate += `/ Tool Details: ` + toolchanges[i].toolComment + ` `
|
||||||
dropdownTemplate += ` from line ` + toolchanges[i].lineNum + ` `
|
// }
|
||||||
dropdownTemplate += `</a></li>`
|
// if (toolchanges[i].sectionComment) {
|
||||||
}
|
// dropdownTemplate += `/ Section ` + toolchanges[i].sectionComment + ` `
|
||||||
$('#toolChangesMenu').html(dropdownTemplate)
|
// }
|
||||||
} else {
|
// dropdownTemplate += `</a></li>`
|
||||||
$('#runBtn').show()
|
// }
|
||||||
$('#runToolsBtn').hide()
|
// $('#toolChangesMenu').html(dropdownTemplate)
|
||||||
}
|
// } else {
|
||||||
|
// $('#runBtn').show()
|
||||||
|
// $('#runToolsBtn').hide()
|
||||||
|
// }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -188,9 +192,17 @@ function runSim() {
|
||||||
// simstop();
|
// simstop();
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
var posx = object.userData.lines[simIdx].p2.x; //- (sizexmax/2);
|
if (object.userData.inch) {
|
||||||
var posy = object.userData.lines[simIdx].p2.y; //- (sizeymax/2);
|
var posx = object.userData.lines[simIdx].p2.x * 25.4; //- (sizexmax/2);
|
||||||
var posz = object.userData.lines[simIdx].p2.z;
|
var posy = object.userData.lines[simIdx].p2.y * 25.4; //- (sizeymax/2);
|
||||||
|
var posz = object.userData.lines[simIdx].p2.z * 25.4;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var posx = object.userData.lines[simIdx].p2.x; //- (sizexmax/2);
|
||||||
|
var posy = object.userData.lines[simIdx].p2.y; //- (sizeymax/2);
|
||||||
|
var posz = object.userData.lines[simIdx].p2.z;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//console.log(posx, posy, posz, object.userData.lines[simIdx])
|
//console.log(posx, posy, posz, object.userData.lines[simIdx])
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ function openGCodeFromText(gcode) {
|
||||||
var box = line.geometry.boundingBox.clone();
|
var box = line.geometry.boundingBox.clone();
|
||||||
line.userData.lines = parsedData.lines
|
line.userData.lines = parsedData.lines
|
||||||
line.userData.bbbox2 = box
|
line.userData.bbbox2 = box
|
||||||
|
line.userData.inch = parsedData.inch
|
||||||
line.name = 'gcodeobject'
|
line.name = 'gcodeobject'
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @author mrdoob / http://mrdoob.com/
|
* @author mrdoob / http://mrdoob.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
THREE.GridHelper = function(sizeX, sizeY, step, colorval) {
|
THREE.GridHelper = function(minX, maxX, minY, maxY, step, colorval) {
|
||||||
|
|
||||||
var geometry = new THREE.Geometry();
|
var geometry = new THREE.Geometry();
|
||||||
var material = new THREE.LineBasicMaterial({
|
var material = new THREE.LineBasicMaterial({
|
||||||
|
@ -12,16 +12,16 @@ THREE.GridHelper = function(sizeX, sizeY, step, colorval) {
|
||||||
this.color = new THREE.Color(colorval);
|
this.color = new THREE.Color(colorval);
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i <= (sizeX); i += step) {
|
for (var i = minX; i <= (maxX); i += step) {
|
||||||
geometry.vertices.push(
|
geometry.vertices.push(
|
||||||
new THREE.Vector3(i, 0, 0), new THREE.Vector3(i, sizeY, 0)
|
new THREE.Vector3(i, minY, 0), new THREE.Vector3(i, maxY, 0)
|
||||||
);
|
);
|
||||||
geometry.colors.push(this.color, this.color, this.color, this.color);
|
geometry.colors.push(this.color, this.color, this.color, this.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i <= (sizeY); i += step) {
|
for (var i = minY; i <= (maxY); i += step) {
|
||||||
geometry.vertices.push(
|
geometry.vertices.push(
|
||||||
new THREE.Vector3(0, i, 0), new THREE.Vector3(sizeX, i, 0)
|
new THREE.Vector3(minX, i, 0), new THREE.Vector3(maxX, i, 0)
|
||||||
|
|
||||||
);
|
);
|
||||||
geometry.colors.push(this.color, this.color, this.color, this.color);
|
geometry.colors.push(this.color, this.color, this.color, this.color);
|
||||||
|
|
Ładowanie…
Reference in New Issue