add discrete device export/import
This commit is contained in:
parent
e8dda00da3
commit
50ea6cb11a
5 changed files with 62 additions and 6 deletions
3
notes.md
3
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)
|
||||
|
|
|
|||
|
|
@ -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 = `<a id="sexport" href="${url}" download="${name}.b64">x</a>`;
|
||||
$('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'),
|
||||
|
|
|
|||
|
|
@ -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<br>${new Date(data.time)}?`).then((yes) => {
|
||||
let prompt = `Import settings made in Kiri:Moto version ${data.version} on<br>${new Date(data.time)}?`;
|
||||
if (isDevice) {
|
||||
prompt = `Import device "${data.device}"?`;
|
||||
}
|
||||
UC.confirm(prompt).then((yes) => {
|
||||
if (yes) doit();
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,6 +232,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="device-action" class="f-row">
|
||||
<button id="device-exp">export</button>
|
||||
<div class="grow"></div>
|
||||
<button id="device-add"><i class="fas fa-plus"></i></button>
|
||||
<button id="device-del"><i class="fas fa-minus"></i></button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue