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)
|
* `F` extend mesh object to store raw + annotations (rot,scale,pos)
|
||||||
* share raw data w/ dups, encode/decode
|
* share raw data w/ dups, encode/decode
|
||||||
* `F` gcode color to speed visualization bar
|
* `F` gcode color to speed visualization bar
|
||||||
|
* `F` X,Y,Z colored axes visaliztions
|
||||||
* `P` bail on decimation if it's proving ineffective
|
* `P` bail on decimation if it's proving ineffective
|
||||||
* `P` improve decimation speed by avoiding in/out of Point?
|
* `P` improve decimation speed by avoiding in/out of Point?
|
||||||
* `P` server-side processing (determine protocol and storage)
|
* `P` server-side processing (determine protocol and storage)
|
||||||
|
|
@ -48,7 +49,9 @@
|
||||||
* `B` contouring should extend beyond part boundaries by tool radius
|
* `B` contouring should extend beyond part boundaries by tool radius
|
||||||
* `B` outside cutting direction in roughing mode inverted
|
* `B` outside cutting direction in roughing mode inverted
|
||||||
* `B` widen outside cuts to prevent chatter on deep (metal) features
|
* `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 bounded slices (extension of z bottom offset feature)
|
||||||
|
* `F` z planar settings visualizations
|
||||||
* `F` use arcs to connect hard angles
|
* `F` use arcs to connect hard angles
|
||||||
* `F` lead-in milling
|
* `F` lead-in milling
|
||||||
* `F` trapezoidal tabs (in the Z axis)
|
* `F` trapezoidal tabs (in the Z axis)
|
||||||
|
|
|
||||||
|
|
@ -466,6 +466,21 @@
|
||||||
}).request("/data/"+ settings().id + "/" + settings().ver, set);
|
}).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() {
|
function profileExport() {
|
||||||
UC.prompt("Export Profile Filename", "kiriconf").then(name => {
|
UC.prompt("Export Profile Filename", "kiriconf").then(name => {
|
||||||
if (name) {
|
if (name) {
|
||||||
|
|
@ -640,6 +655,7 @@
|
||||||
UI.deviceSave.disabled = !local;
|
UI.deviceSave.disabled = !local;
|
||||||
UI.deviceDelete.disabled = !local;
|
UI.deviceDelete.disabled = !local;
|
||||||
UI.deviceAdd.disabled = dev.noclone;
|
UI.deviceAdd.disabled = dev.noclone;
|
||||||
|
UI.deviceExport.disabled = !local;
|
||||||
|
|
||||||
API.view.update_fields();
|
API.view.update_fields();
|
||||||
platform.update_size();
|
platform.update_size();
|
||||||
|
|
@ -714,6 +730,15 @@
|
||||||
removeLocalDevice(getSelectedDevice());
|
removeLocalDevice(getSelectedDevice());
|
||||||
showDevices();
|
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() {
|
UI.deviceAll.onclick = function() {
|
||||||
API.show.favorites(false);
|
API.show.favorites(false);
|
||||||
|
|
@ -1195,6 +1220,7 @@
|
||||||
deviceList: $('device-list'),
|
deviceList: $('device-list'),
|
||||||
deviceAdd: $('device-add'),
|
deviceAdd: $('device-add'),
|
||||||
deviceDelete: $('device-del'),
|
deviceDelete: $('device-del'),
|
||||||
|
deviceExport: $('device-exp'),
|
||||||
deviceSave: $('device-save'),
|
deviceSave: $('device-save'),
|
||||||
deviceFavorites: $('device-favorites'),
|
deviceFavorites: $('device-favorites'),
|
||||||
deviceAll: $('device-all'),
|
deviceAll: $('device-all'),
|
||||||
|
|
|
||||||
|
|
@ -1533,18 +1533,39 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(data.settings && data.version && data.time)) {
|
let isSettings = (data.settings && data.version && data.time);
|
||||||
UC.alert('invalid settings format');
|
let isDevice = (data.device && data.version && data.time);
|
||||||
|
if (!isSettings && !isDevice) {
|
||||||
|
UC.alert('invalid settings or device format');
|
||||||
console.log('data',data);
|
console.log('data',data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
function doit() {
|
function doit() {
|
||||||
settings = CONF.normalize(data.settings);
|
if (isSettings) {
|
||||||
API.conf.save();
|
settings = CONF.normalize(data.settings);
|
||||||
API.space.reload();
|
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) {
|
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();
|
if (yes) doit();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -769,6 +769,11 @@ th, tr, td, label {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
#device-exp {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
#device-action, #tool-action {
|
#device-action, #tool-action {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="device-action" class="f-row">
|
<div id="device-action" class="f-row">
|
||||||
|
<button id="device-exp">export</button>
|
||||||
<div class="grow"></div>
|
<div class="grow"></div>
|
||||||
<button id="device-add"><i class="fas fa-plus"></i></button>
|
<button id="device-add"><i class="fas fa-plus"></i></button>
|
||||||
<button id="device-del"><i class="fas fa-minus"></i></button>
|
<button id="device-del"><i class="fas fa-minus"></i></button>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue