add laser filters, origin bounds
This commit is contained in:
parent
a0e1efca1b
commit
8cf7ccb336
10 changed files with 85 additions and 27 deletions
|
|
@ -205,6 +205,7 @@ var gs_kiri_conf = exports;
|
||||||
outputLaserPower: 1,
|
outputLaserPower: 1,
|
||||||
outputLaserSpeed: 1,
|
outputLaserSpeed: 1,
|
||||||
outputLaserGroup: 1,
|
outputLaserGroup: 1,
|
||||||
|
outputOriginBounds: 1,
|
||||||
outputOriginCenter: 1,
|
outputOriginCenter: 1,
|
||||||
outputInvertX: 1,
|
outputInvertX: 1,
|
||||||
outputInvertY: 1
|
outputInvertY: 1
|
||||||
|
|
@ -430,6 +431,7 @@ var gs_kiri_conf = exports;
|
||||||
|
|
||||||
// --- shared FDM/Laser/CAM ---
|
// --- shared FDM/Laser/CAM ---
|
||||||
|
|
||||||
|
outputOriginBounds: true,
|
||||||
outputOriginCenter: true,
|
outputOriginCenter: true,
|
||||||
outputInvertX: false,
|
outputInvertX: false,
|
||||||
outputInvertY: false
|
outputInvertY: false
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let gs_kiri_cam = exports;
|
var gs_kiri_cam = exports;
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,18 +114,18 @@ var gs_kiri_init = exports;
|
||||||
setDeviceRound: UC.newBoolean(LANG.dev_bedc, onBooleanClick, {title:LANG.dev_bedc_desc, modes:FDM}),
|
setDeviceRound: UC.newBoolean(LANG.dev_bedc, onBooleanClick, {title:LANG.dev_bedc_desc, modes:FDM}),
|
||||||
|
|
||||||
setDevice: UC.newGroup("gcode", $('device')),
|
setDevice: UC.newGroup("gcode", $('device')),
|
||||||
setDeviceFan: UC.newInput(LANG.dev_fanp, {title:LANG.dev_fanp_desc, modes:FDM, size:15}),
|
setDeviceFan: UC.newInput(LANG.dev_fanp, {title:LANG.dev_fanp_desc, modes:FDM, size:17}),
|
||||||
setDeviceTrack: UC.newInput(LANG.dev_prog, {title:LANG.dev_prog_desc, modes:FDM, size:15}),
|
setDeviceTrack: UC.newInput(LANG.dev_prog, {title:LANG.dev_prog_desc, modes:FDM, size:17}),
|
||||||
setDeviceLayer: UC.newText(LANG.dev_layer, {title:LANG.dev_layer_desc, modes:FDM, size:14, height: 2}),
|
setDeviceLayer: UC.newText(LANG.dev_layer, {title:LANG.dev_layer_desc, modes:FDM, size:14, height: 2}),
|
||||||
setDeviceToken: UC.newBoolean(LANG.dev_token, null, {title:LANG.dev_token_desc, modes:CAM}),
|
setDeviceToken: UC.newBoolean(LANG.dev_token, null, {title:LANG.dev_token_desc, modes:CAM_LASER}),
|
||||||
setDeviceStrip: UC.newBoolean(LANG.dev_strip, null, {title:LANG.dev_strip_desc, modes:CAM}),
|
setDeviceStrip: UC.newBoolean(LANG.dev_strip, null, {title:LANG.dev_strip_desc, modes:CAM_LASER}),
|
||||||
setDeviceFExt: UC.newInput(LANG.dev_fext, {title:LANG.dev_fext_desc, modes:CAM, size:5}),
|
setDeviceFExt: UC.newInput(LANG.dev_fext, {title:LANG.dev_fext_desc, modes:CAM_LASER, size:7}),
|
||||||
setDeviceDwell: UC.newText(LANG.dev_dwell, {title:LANG.dev_dwell_desc, modes:CAM, size:14, height:2}),
|
setDeviceDwell: UC.newText(LANG.dev_dwell, {title:LANG.dev_dwell_desc, modes:CAM, size:14, height:2}),
|
||||||
setDeviceChange: UC.newText(LANG.dev_tool, {title:LANG.dev_tool_desc, modes:CAM, size:14, height:2}),
|
setDeviceChange: UC.newText(LANG.dev_tool, {title:LANG.dev_tool_desc, modes:CAM, size:14, height:2}),
|
||||||
setDeviceSpindle: UC.newText(LANG.dev_speed, {title:LANG.dev_speed_desc, modes:CAM, size:14, height:2}),
|
setDeviceSpindle: UC.newText(LANG.dev_speed, {title:LANG.dev_speed_desc, modes:CAM, size:14, height:2}),
|
||||||
setDevicePause: UC.newText(LANG.dev_pause, {title:LANG.dev_pause_desc, modes:FDM, size:14, height:3}),
|
setDevicePause: UC.newText(LANG.dev_pause, {title:LANG.dev_pause_desc, modes:FDM, size:14, height:3}),
|
||||||
setDevicePre: UC.newText(LANG.dev_head, {title:LANG.dev_head_desc, modes:FDM_CAM, size:14, height:3}),
|
setDevicePre: UC.newText(LANG.dev_head, {title:LANG.dev_head_desc, xmodes:FDM_CAM, size:14, height:3}),
|
||||||
setDevicePost: UC.newText(LANG.dev_foot, {title:LANG.dev_foot_desc, modes:FDM_CAM, size:14, height:3}),
|
setDevicePost: UC.newText(LANG.dev_foot, {title:LANG.dev_foot_desc, xmodes:FDM_CAM, size:14, height:3}),
|
||||||
|
|
||||||
tools: $('tools'),
|
tools: $('tools'),
|
||||||
toolsSave: $('tools-save'),
|
toolsSave: $('tools-save'),
|
||||||
|
|
@ -190,7 +190,7 @@ var gs_kiri_init = exports;
|
||||||
sysTable: UC.newTableRow([
|
sysTable: UC.newTableRow([
|
||||||
[
|
[
|
||||||
UI.setupDevices =
|
UI.setupDevices =
|
||||||
UC.newButton("Devices", showDevices, {modes:FDM_CAM})
|
UC.newButton("Devices", showDevices)
|
||||||
],[
|
],[
|
||||||
UI.setupTools =
|
UI.setupTools =
|
||||||
UC.newButton("Tools", showTools, {modes:CAM})
|
UC.newButton("Tools", showTools, {modes:CAM})
|
||||||
|
|
@ -287,10 +287,6 @@ var gs_kiri_init = exports;
|
||||||
]
|
]
|
||||||
]),
|
]),
|
||||||
|
|
||||||
platform: UC.newGroup("build area", control, {modes:LASER}),
|
|
||||||
bedWidth: UC.newInput("width", {title:"millimeters", convert:UC.toInt, modes:LASER}),
|
|
||||||
bedDepth: UC.newInput("depth", {title:"millimeters", convert:UC.toInt, modes:LASER}),
|
|
||||||
|
|
||||||
process: UC.newGroup("slicing", control, {modes:FDM_LASER}),
|
process: UC.newGroup("slicing", control, {modes:FDM_LASER}),
|
||||||
|
|
||||||
// 3d print
|
// 3d print
|
||||||
|
|
@ -409,6 +405,7 @@ var gs_kiri_init = exports;
|
||||||
camStockY: UC.newInput("depth", {title:"depth (y) in workspace units\n0 defaults to part size", convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
|
camStockY: UC.newInput("depth", {title:"depth (y) in workspace units\n0 defaults to part size", convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
|
||||||
camStockZ: UC.newInput("height", {title:"height (z) in workspace units\n0 defaults to part size", convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
|
camStockZ: UC.newInput("height", {title:"height (z) in workspace units\n0 defaults to part size", convert:UC.toFloat, bound:UC.bound(0,9999), modes:CAM}),
|
||||||
camStockOffset: UC.newBoolean("offset", onBooleanClick, {title: "use width, depth, height\nas offsets from max\npart size on platform", modes:CAM}),
|
camStockOffset: UC.newBoolean("offset", onBooleanClick, {title: "use width, depth, height\nas offsets from max\npart size on platform", modes:CAM}),
|
||||||
|
outputOriginBounds: UC.newBoolean("origin bounds", onBooleanClick, {modes:LASER}),
|
||||||
outputOriginCenter: UC.newBoolean("origin center", onBooleanClick, {modes:CAM_LASER}),
|
outputOriginCenter: UC.newBoolean("origin center", onBooleanClick, {modes:CAM_LASER}),
|
||||||
camOriginTop: UC.newBoolean("origin top", onBooleanClick, {modes:CAM}),
|
camOriginTop: UC.newBoolean("origin top", onBooleanClick, {modes:CAM}),
|
||||||
|
|
||||||
|
|
@ -838,7 +835,6 @@ var gs_kiri_init = exports;
|
||||||
function selectDevice(devicename, lock) {
|
function selectDevice(devicename, lock) {
|
||||||
deviceLock = lock;
|
deviceLock = lock;
|
||||||
if (lock) UI.setupDevices.style.display = 'none';
|
if (lock) UI.setupDevices.style.display = 'none';
|
||||||
if (API.mode.get() === 'LASER') return;
|
|
||||||
if (isLocalDevice(devicename)) {
|
if (isLocalDevice(devicename)) {
|
||||||
setDeviceCode(settings().devices[devicename], devicename);
|
setDeviceCode(settings().devices[devicename], devicename);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1329,7 +1325,7 @@ var gs_kiri_init = exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDevices() {
|
function showDevices() {
|
||||||
if (API.mode.get_id() === MODES.LASER || deviceLock) return;
|
if (deviceLock) return;
|
||||||
|
|
||||||
API.ajax("/api/filters-"+API.mode.get_lower(), function(flvalue) {
|
API.ajax("/api/filters-"+API.mode.get_lower(), function(flvalue) {
|
||||||
if (!flvalue) return;
|
if (!flvalue) return;
|
||||||
|
|
@ -1433,9 +1429,6 @@ var gs_kiri_init = exports;
|
||||||
UI.toolShaftLen, updateTool,
|
UI.toolShaftLen, updateTool,
|
||||||
// UI.toolTaperAngle, updateTool,
|
// UI.toolTaperAngle, updateTool,
|
||||||
UI.toolTaperTip, updateTool,
|
UI.toolTaperTip, updateTool,
|
||||||
|
|
||||||
UI.bedWidth, platform.update_size,
|
|
||||||
UI.bedDepth, platform.update_size
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
UI.setupDevices.innerHTML = "D<u>e</u>vices";
|
UI.setupDevices.innerHTML = "D<u>e</u>vices";
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ var gs_kiri_lang = exports;
|
||||||
dev_token_desc: "gcode token spacer",
|
dev_token_desc: "gcode token spacer",
|
||||||
dev_strip: "strip comments",
|
dev_strip: "strip comments",
|
||||||
dev_strip_desc: "strip gcode comments",
|
dev_strip_desc: "strip gcode comments",
|
||||||
dev_fext: "file ext",
|
dev_fext: "file extension",
|
||||||
dev_fext_desc: "file name extension",
|
dev_fext_desc: "file name extension",
|
||||||
dev_dwell: "dwell",
|
dev_dwell: "dwell",
|
||||||
dev_dwell_desc: "gcode dwell script",
|
dev_dwell_desc: "gcode dwell script",
|
||||||
|
|
|
||||||
19
js/kiri.js
19
js/kiri.js
|
|
@ -883,6 +883,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
******************************************************************* */
|
******************************************************************* */
|
||||||
|
|
||||||
function platformUpdateOrigin() {
|
function platformUpdateOrigin() {
|
||||||
|
platform.update_bounds();
|
||||||
let dev = settings.device;
|
let dev = settings.device;
|
||||||
let proc = settings.process;
|
let proc = settings.process;
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
|
@ -899,8 +900,14 @@ self.kiri.license = exports.LICENSE;
|
||||||
x = (-camStock.scale.x / 2) + camStock.position.x;
|
x = (-camStock.scale.x / 2) + camStock.position.x;
|
||||||
y = (camStock.scale.y / 2) - camStock.position.y;
|
y = (camStock.scale.y / 2) - camStock.position.y;
|
||||||
} else {
|
} else {
|
||||||
x = -dev.bedWidth / 2;
|
if (MODE === MODES.LASER && proc.outputOriginBounds) {
|
||||||
y = dev.bedDepth / 2;
|
let b = settings.bounds;
|
||||||
|
x = b.min.x,
|
||||||
|
y = -b.min.y
|
||||||
|
} else {
|
||||||
|
x = -dev.bedWidth / 2;
|
||||||
|
y = dev.bedDepth / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (camStock) {
|
} else if (camStock) {
|
||||||
x = camStock.position.x;
|
x = camStock.position.x;
|
||||||
|
|
@ -940,7 +947,10 @@ self.kiri.license = exports.LICENSE;
|
||||||
function platformUpdateBounds() {
|
function platformUpdateBounds() {
|
||||||
var bounds = new THREE.Box3();
|
var bounds = new THREE.Box3();
|
||||||
forAllWidgets(function(widget) {
|
forAllWidgets(function(widget) {
|
||||||
bounds.union(widget.mesh.getBoundingBox());
|
let wp = widget.orient.pos;
|
||||||
|
let wb = widget.mesh.getBoundingBox().clone();
|
||||||
|
wb.translate(widget.orient.pos);
|
||||||
|
bounds.union(wb);
|
||||||
});
|
});
|
||||||
return settings.bounds = bounds;
|
return settings.bounds = bounds;
|
||||||
}
|
}
|
||||||
|
|
@ -1131,6 +1141,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
if (MODE === MODES.CAM) {
|
if (MODE === MODES.CAM) {
|
||||||
platform.update_stock();
|
platform.update_stock();
|
||||||
}
|
}
|
||||||
|
platform.update_origin();
|
||||||
|
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
}
|
}
|
||||||
|
|
@ -1208,7 +1219,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
} else if (settings.controller.alignTop) {
|
} else if (settings.controller.alignTop) {
|
||||||
platform.update_top_z();
|
platform.update_top_z();
|
||||||
}
|
}
|
||||||
platform.update_bounds();
|
|
||||||
platform.update_origin();
|
platform.update_origin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1576,7 +1586,6 @@ self.kiri.license = exports.LICENSE;
|
||||||
// update selection display (off for laser)
|
// update selection display (off for laser)
|
||||||
$('selected-device').innerHTML = currentDeviceName();
|
$('selected-device').innerHTML = currentDeviceName();
|
||||||
$('selected-process').innerHTML = name;
|
$('selected-process').innerHTML = name;
|
||||||
$('selected').style.display = (mode !== 'LASER') ? 'block' : 'none';
|
|
||||||
|
|
||||||
// FDM process settings overridden by device
|
// FDM process settings overridden by device
|
||||||
if (mode == "FDM") {
|
if (mode == "FDM") {
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,9 @@ function prepareScripts() {
|
||||||
fs.readdir("./web/kiri/filter/CAM", function(err, files) {
|
fs.readdir("./web/kiri/filter/CAM", function(err, files) {
|
||||||
filters_cam = files || filters_cam;
|
filters_cam = files || filters_cam;
|
||||||
});
|
});
|
||||||
|
fs.readdir("./web/kiri/filter/LASER", function(err, files) {
|
||||||
|
filters_laser = files || filters_laser;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -763,6 +766,7 @@ let ver = require('../js/license.js'),
|
||||||
fileMap = {},
|
fileMap = {},
|
||||||
filters_fdm = [],
|
filters_fdm = [],
|
||||||
filters_cam = [],
|
filters_cam = [],
|
||||||
|
filters_laser = [],
|
||||||
modPaths = [],
|
modPaths = [],
|
||||||
ipCache = {},
|
ipCache = {},
|
||||||
clearOK = [
|
clearOK = [
|
||||||
|
|
@ -934,6 +938,11 @@ const api = {
|
||||||
"filters-cam": (req, res, next) => {
|
"filters-cam": (req, res, next) => {
|
||||||
res.setHeader("Content-Type", "application/javascript");
|
res.setHeader("Content-Type", "application/javascript");
|
||||||
res.end(obj2string(filters_cam));
|
res.end(obj2string(filters_cam));
|
||||||
|
},
|
||||||
|
|
||||||
|
"filters-laser": (req, res, next) => {
|
||||||
|
res.setHeader("Content-Type", "application/javascript");
|
||||||
|
res.end(obj2string(filters_laser));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -1168,7 +1177,7 @@ function open_logger(options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let next_pattern = moment().format(pattern);
|
let next_pattern = moment().format(pattern);
|
||||||
if (++count >= count_min && next_pattern !== last_pattern) {
|
if (++count > count_min && next_pattern !== last_pattern) {
|
||||||
open_file_stream();
|
open_file_stream();
|
||||||
}
|
}
|
||||||
let output = [moment().format('YYMMDD-HHmmss'),' ',JSON.stringify(obj),'\n'].join('');
|
let output = [moment().format('YYMMDD-HHmmss'),' ',JSON.stringify(obj),'\n'].join('');
|
||||||
|
|
|
||||||
16
web/kiri/filter/LASER/Any.Generic.Laser
Normal file
16
web/kiri/filter/LASER/Any.Generic.Laser
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"file-ext": "gcode",
|
||||||
|
"token-space": " ",
|
||||||
|
"strip-comments": false,
|
||||||
|
"pre":[
|
||||||
|
"G21 ; set units to MM (required)",
|
||||||
|
"G90 ; absolute position mode (required)"
|
||||||
|
],
|
||||||
|
"post":[
|
||||||
|
"M30 ; program end"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"bed_width": 300,
|
||||||
|
"bed_depth": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
16
web/kiri/filter/LASER/Glowforge
Normal file
16
web/kiri/filter/LASER/Glowforge
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"file-ext": "gcode",
|
||||||
|
"token-space": " ",
|
||||||
|
"strip-comments": false,
|
||||||
|
"pre":[
|
||||||
|
"G21 ; set units to MM (required)",
|
||||||
|
"G90 ; absolute position mode (required)"
|
||||||
|
],
|
||||||
|
"post":[
|
||||||
|
"M30 ; program end"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"bed_width": 500,
|
||||||
|
"bed_depth": 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -526,8 +526,16 @@ button.selected {
|
||||||
#device-list option[favorite="1"] {
|
#device-list option[favorite="1"] {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
#device > div {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
#device label {
|
#device label {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
#device input {
|
||||||
|
margin: 2px;
|
||||||
}
|
}
|
||||||
#device textarea {
|
#device textarea {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,9 @@ button[del] {
|
||||||
margin-right: -14px !important;
|
margin-right: -14px !important;
|
||||||
margin-bottom: -14px !important;
|
margin-bottom: -14px !important;
|
||||||
}
|
}
|
||||||
|
.control label {
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
.control input {
|
.control input {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
|
|
@ -196,12 +199,14 @@ button[del] {
|
||||||
.control button {
|
.control button {
|
||||||
margin: 1px;
|
margin: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control select {
|
.control select {
|
||||||
margin-bottom: 1px !important;
|
margin-bottom: 1px !important;
|
||||||
margin-right: 2px !important;
|
margin-right: 2px !important;
|
||||||
}
|
}
|
||||||
|
.control > div > div {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
#control-left:hover, #control-right:hover {
|
#control-left:hover, #control-right:hover {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue