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,
|
||||
outputLaserSpeed: 1,
|
||||
outputLaserGroup: 1,
|
||||
outputOriginBounds: 1,
|
||||
outputOriginCenter: 1,
|
||||
outputInvertX: 1,
|
||||
outputInvertY: 1
|
||||
|
|
@ -430,6 +431,7 @@ var gs_kiri_conf = exports;
|
|||
|
||||
// --- shared FDM/Laser/CAM ---
|
||||
|
||||
outputOriginBounds: true,
|
||||
outputOriginCenter: true,
|
||||
outputInvertX: false,
|
||||
outputInvertY: false
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let gs_kiri_cam = exports;
|
||||
var gs_kiri_cam = exports;
|
||||
|
||||
(function() {
|
||||
|
||||
|
|
|
|||
|
|
@ -114,18 +114,18 @@ var gs_kiri_init = exports;
|
|||
setDeviceRound: UC.newBoolean(LANG.dev_bedc, onBooleanClick, {title:LANG.dev_bedc_desc, modes:FDM}),
|
||||
|
||||
setDevice: UC.newGroup("gcode", $('device')),
|
||||
setDeviceFan: UC.newInput(LANG.dev_fanp, {title:LANG.dev_fanp_desc, modes:FDM, size:15}),
|
||||
setDeviceTrack: UC.newInput(LANG.dev_prog, {title:LANG.dev_prog_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:17}),
|
||||
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}),
|
||||
setDeviceStrip: UC.newBoolean(LANG.dev_strip, null, {title:LANG.dev_strip_desc, modes:CAM}),
|
||||
setDeviceFExt: UC.newInput(LANG.dev_fext, {title:LANG.dev_fext_desc, modes:CAM, size:5}),
|
||||
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_LASER}),
|
||||
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}),
|
||||
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}),
|
||||
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}),
|
||||
setDevicePost: UC.newText(LANG.dev_foot, {title:LANG.dev_foot_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, xmodes:FDM_CAM, size:14, height:3}),
|
||||
|
||||
tools: $('tools'),
|
||||
toolsSave: $('tools-save'),
|
||||
|
|
@ -190,7 +190,7 @@ var gs_kiri_init = exports;
|
|||
sysTable: UC.newTableRow([
|
||||
[
|
||||
UI.setupDevices =
|
||||
UC.newButton("Devices", showDevices, {modes:FDM_CAM})
|
||||
UC.newButton("Devices", showDevices)
|
||||
],[
|
||||
UI.setupTools =
|
||||
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}),
|
||||
|
||||
// 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}),
|
||||
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}),
|
||||
outputOriginBounds: UC.newBoolean("origin bounds", onBooleanClick, {modes:LASER}),
|
||||
outputOriginCenter: UC.newBoolean("origin center", onBooleanClick, {modes:CAM_LASER}),
|
||||
camOriginTop: UC.newBoolean("origin top", onBooleanClick, {modes:CAM}),
|
||||
|
||||
|
|
@ -838,7 +835,6 @@ var gs_kiri_init = exports;
|
|||
function selectDevice(devicename, lock) {
|
||||
deviceLock = lock;
|
||||
if (lock) UI.setupDevices.style.display = 'none';
|
||||
if (API.mode.get() === 'LASER') return;
|
||||
if (isLocalDevice(devicename)) {
|
||||
setDeviceCode(settings().devices[devicename], devicename);
|
||||
} else {
|
||||
|
|
@ -1329,7 +1325,7 @@ var gs_kiri_init = exports;
|
|||
}
|
||||
|
||||
function showDevices() {
|
||||
if (API.mode.get_id() === MODES.LASER || deviceLock) return;
|
||||
if (deviceLock) return;
|
||||
|
||||
API.ajax("/api/filters-"+API.mode.get_lower(), function(flvalue) {
|
||||
if (!flvalue) return;
|
||||
|
|
@ -1433,9 +1429,6 @@ var gs_kiri_init = exports;
|
|||
UI.toolShaftLen, updateTool,
|
||||
// UI.toolTaperAngle, updateTool,
|
||||
UI.toolTaperTip, updateTool,
|
||||
|
||||
UI.bedWidth, platform.update_size,
|
||||
UI.bedDepth, platform.update_size
|
||||
]);
|
||||
|
||||
UI.setupDevices.innerHTML = "D<u>e</u>vices";
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ var gs_kiri_lang = exports;
|
|||
dev_token_desc: "gcode token spacer",
|
||||
dev_strip: "strip comments",
|
||||
dev_strip_desc: "strip gcode comments",
|
||||
dev_fext: "file ext",
|
||||
dev_fext: "file extension",
|
||||
dev_fext_desc: "file name extension",
|
||||
dev_dwell: "dwell",
|
||||
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() {
|
||||
platform.update_bounds();
|
||||
let dev = settings.device;
|
||||
let proc = settings.process;
|
||||
let x = 0;
|
||||
|
|
@ -899,8 +900,14 @@ self.kiri.license = exports.LICENSE;
|
|||
x = (-camStock.scale.x / 2) + camStock.position.x;
|
||||
y = (camStock.scale.y / 2) - camStock.position.y;
|
||||
} else {
|
||||
x = -dev.bedWidth / 2;
|
||||
y = dev.bedDepth / 2;
|
||||
if (MODE === MODES.LASER && proc.outputOriginBounds) {
|
||||
let b = settings.bounds;
|
||||
x = b.min.x,
|
||||
y = -b.min.y
|
||||
} else {
|
||||
x = -dev.bedWidth / 2;
|
||||
y = dev.bedDepth / 2;
|
||||
}
|
||||
}
|
||||
} else if (camStock) {
|
||||
x = camStock.position.x;
|
||||
|
|
@ -940,7 +947,10 @@ self.kiri.license = exports.LICENSE;
|
|||
function platformUpdateBounds() {
|
||||
var bounds = new THREE.Box3();
|
||||
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;
|
||||
}
|
||||
|
|
@ -1131,6 +1141,7 @@ self.kiri.license = exports.LICENSE;
|
|||
if (MODE === MODES.CAM) {
|
||||
platform.update_stock();
|
||||
}
|
||||
platform.update_origin();
|
||||
|
||||
SPACE.update();
|
||||
}
|
||||
|
|
@ -1208,7 +1219,6 @@ self.kiri.license = exports.LICENSE;
|
|||
} else if (settings.controller.alignTop) {
|
||||
platform.update_top_z();
|
||||
}
|
||||
platform.update_bounds();
|
||||
platform.update_origin();
|
||||
}
|
||||
|
||||
|
|
@ -1576,7 +1586,6 @@ self.kiri.license = exports.LICENSE;
|
|||
// update selection display (off for laser)
|
||||
$('selected-device').innerHTML = currentDeviceName();
|
||||
$('selected-process').innerHTML = name;
|
||||
$('selected').style.display = (mode !== 'LASER') ? 'block' : 'none';
|
||||
|
||||
// FDM process settings overridden by device
|
||||
if (mode == "FDM") {
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@ function prepareScripts() {
|
|||
fs.readdir("./web/kiri/filter/CAM", function(err, files) {
|
||||
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 = {},
|
||||
filters_fdm = [],
|
||||
filters_cam = [],
|
||||
filters_laser = [],
|
||||
modPaths = [],
|
||||
ipCache = {},
|
||||
clearOK = [
|
||||
|
|
@ -934,6 +938,11 @@ const api = {
|
|||
"filters-cam": (req, res, next) => {
|
||||
res.setHeader("Content-Type", "application/javascript");
|
||||
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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
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"] {
|
||||
font-weight: bold;
|
||||
}
|
||||
#device > div {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#device label {
|
||||
white-space: nowrap;
|
||||
padding: 2px;
|
||||
}
|
||||
#device input {
|
||||
margin: 2px;
|
||||
}
|
||||
#device textarea {
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
|
@ -174,6 +174,9 @@ button[del] {
|
|||
margin-right: -14px !important;
|
||||
margin-bottom: -14px !important;
|
||||
}
|
||||
.control label {
|
||||
padding: 2px;
|
||||
}
|
||||
.control input {
|
||||
background-color: #eee;
|
||||
margin-bottom: 1px;
|
||||
|
|
@ -196,12 +199,14 @@ button[del] {
|
|||
.control button {
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
.control select {
|
||||
margin-bottom: 1px !important;
|
||||
margin-right: 2px !important;
|
||||
}
|
||||
|
||||
.control > div > div {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#control-left:hover, #control-right:hover {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue