diff --git a/notes.md b/notes.md index de8971e6..4d5726a3 100644 --- a/notes.md +++ b/notes.md @@ -6,6 +6,7 @@ * `F` extend mesh object to store raw + annotations (rot,scale,pos) * share raw data w/ dups, encode/decode * `F` gcode color to speed visualization bar +* `F` X,Y,Z colored axes visaliztions * `P` bail on decimation if it's proving ineffective * `P` improve decimation speed by avoiding in/out of Point? * `P` server-side processing (determine protocol and storage) @@ -48,7 +49,9 @@ * `B` contouring should extend beyond part boundaries by tool radius * `B` outside cutting direction in roughing mode inverted * `B` widen outside cuts to prevent chatter on deep (metal) features +* `F` provide planar or other visual hint of current z bottom offset * `F` z bounded slices (extension of z bottom offset feature) +* `F` z planar settings visualizations * `F` use arcs to connect hard angles * `F` lead-in milling * `F` trapezoidal tabs (in the Z axis) diff --git a/src/kiri/init.js b/src/kiri/init.js index c41890f9..d6ad281f 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -466,6 +466,21 @@ }).request("/data/"+ settings().id + "/" + settings().ver, set); } + function deviceExport(exp, name) { + name = (name || "kiridev") + .toLowerCase() + .replace(/ /g,'_') + .replace(/\./g,'_'); + UC.prompt("Export Device Filename", name).then(name => { + if (name) { + let blob = new Blob([exp], {type: "octet/stream"}), + url = WIN.URL.createObjectURL(blob); + $('mod-any').innerHTML = `x`; + $('sexport').click(); + } + }); + } + function profileExport() { UC.prompt("Export Profile Filename", "kiriconf").then(name => { if (name) { @@ -640,6 +655,7 @@ UI.deviceSave.disabled = !local; UI.deviceDelete.disabled = !local; UI.deviceAdd.disabled = dev.noclone; + UI.deviceExport.disabled = !local; API.view.update_fields(); platform.update_size(); @@ -714,6 +730,15 @@ removeLocalDevice(getSelectedDevice()); showDevices(); }; + UI.deviceExport.onclick = function() { + let exp = btoa(JSON.stringify({ + version: KIRI.version, + device: selected, + code: devs[selected], + time: Date.now() + })); + deviceExport(exp, selected); + }; UI.deviceAll.onclick = function() { API.show.favorites(false); @@ -1195,6 +1220,7 @@ deviceList: $('device-list'), deviceAdd: $('device-add'), deviceDelete: $('device-del'), + deviceExport: $('device-exp'), deviceSave: $('device-save'), deviceFavorites: $('device-favorites'), deviceAll: $('device-all'), diff --git a/src/kiri/main.js b/src/kiri/main.js index a402371c..15bc375f 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -1533,18 +1533,39 @@ return; } } - if (!(data.settings && data.version && data.time)) { - UC.alert('invalid settings format'); + let isSettings = (data.settings && data.version && data.time); + let isDevice = (data.device && data.version && data.time); + if (!isSettings && !isDevice) { + UC.alert('invalid settings or device format'); console.log('data',data); return; } function doit() { - settings = CONF.normalize(data.settings); - API.conf.save(); - API.space.reload(); + if (isSettings) { + settings = CONF.normalize(data.settings); + API.conf.save(); + API.space.reload(); + } + if (isDevice) { + if (settings.devices[data.device]) { + UC.confirm(`Replace device ${data.device}?`).then(yes => { + if (yes) { + settings.devices[data.device] = data.code; + API.show.devices(); + } + }); + } else { + settings.devices[data.device] = data.code; + API.show.devices(); + } + } } if (ask) { - UC.confirm(`Import settings made in Kiri:Moto version ${data.version} on
${new Date(data.time)}?`).then((yes) => { + let prompt = `Import settings made in Kiri:Moto version ${data.version} on
${new Date(data.time)}?`; + if (isDevice) { + prompt = `Import device "${data.device}"?`; + } + UC.confirm(prompt).then((yes) => { if (yes) doit(); }); } else { diff --git a/web/kiri/index.css b/web/kiri/index.css index 57ca2dde..79bb50de 100644 --- a/web/kiri/index.css +++ b/web/kiri/index.css @@ -769,6 +769,11 @@ th, tr, td, label { font-family: monospace; width: 100%; } +#device-exp { + position: absolute; + left: 0; + z-index: 10; +} #device-action, #tool-action { margin-top: 5px; } diff --git a/web/kiri/index.html b/web/kiri/index.html index 32d06c55..2df075a3 100644 --- a/web/kiri/index.html +++ b/web/kiri/index.html @@ -232,6 +232,7 @@
+