fix device renames, top sla slice
This commit is contained in:
parent
8da355efbc
commit
109f27e2e3
5 changed files with 35 additions and 22 deletions
|
|
@ -63,7 +63,8 @@ let gs_kiri_sla = exports;
|
|||
});
|
||||
|
||||
SLICER.sliceWidget(widget, {
|
||||
height: process.slaSlice || 0.05
|
||||
height: process.slaSlice || 0.05,
|
||||
add: true
|
||||
}, function(slices) {
|
||||
widget.slices = slices.filter(slice => slice.tops.length);
|
||||
// reset for solids and support projections
|
||||
|
|
@ -163,11 +164,12 @@ let gs_kiri_sla = exports;
|
|||
ctx.fill();
|
||||
count++;
|
||||
});
|
||||
} else {
|
||||
console.log({no_slice_at: index})
|
||||
}
|
||||
});
|
||||
output.push(ctx.getImageData(0,0,height,width));
|
||||
update(index / layermax);
|
||||
|
||||
if (count === 0) break;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +231,6 @@ let gs_kiri_sla = exports;
|
|||
|
||||
for (let index=0; ; index++) {
|
||||
let layer = KIRI.newLayer(print.group);
|
||||
print.printView.push(layer);
|
||||
|
||||
let count = 0;
|
||||
widgets.forEach(widget => {
|
||||
|
|
@ -249,8 +250,10 @@ let gs_kiri_sla = exports;
|
|||
// TODO fix with contract for exposing layer count
|
||||
// hack uses expected gcode output array in print object
|
||||
print.output = print.printView;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
print.printView.push(layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -652,6 +652,19 @@ var gs_kiri_init = exports;
|
|||
API.event.settings();
|
||||
}
|
||||
|
||||
function updateDeviceName() {
|
||||
console.log('update device name');
|
||||
let newname = UI.deviceName.value,
|
||||
selected = API.device.get(),
|
||||
devs = settings().devices;
|
||||
if (newname !== selected) {
|
||||
devs[newname] = devs[selected];
|
||||
delete devs[selected];
|
||||
UI.deviceSave.onclick();
|
||||
selectDevice(newname);
|
||||
}
|
||||
}
|
||||
|
||||
function renderDevices(devices) {
|
||||
UI.devices.onclick = UC.hidePop;
|
||||
UC.hidePop();
|
||||
|
|
@ -677,15 +690,9 @@ var gs_kiri_init = exports;
|
|||
|
||||
UI.deviceClose.onclick = API.dialog.hide;
|
||||
UI.deviceSave.onclick = function() {
|
||||
let newname = UI.deviceName.value
|
||||
if (newname !== selected) {
|
||||
devs[newname] = devs[selected];
|
||||
delete devs[selected];
|
||||
}
|
||||
API.function.clear();
|
||||
API.conf.save();
|
||||
showDevices();
|
||||
selectDevice(newname);
|
||||
};
|
||||
UI.deviceAdd.onclick = function() {
|
||||
API.function.clear();
|
||||
|
|
@ -1146,7 +1153,7 @@ var gs_kiri_init = exports;
|
|||
stockHeight: $('stock-width'),
|
||||
|
||||
device: UC.newGroup(LANG.dv_gr_dev, $('device'), {group:"ddev", nocompact:true}),
|
||||
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:"60%", text:true}),
|
||||
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:"60%", text:true, action:updateDeviceName}),
|
||||
bedWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toInt}),
|
||||
bedDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toInt}),
|
||||
maxHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toInt, modes:FDM_SLA}),
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var gs_kiri_layer = exports;
|
||||
let gs_kiri_layer = exports;
|
||||
|
||||
(function() {
|
||||
|
||||
if (!self.kiri) self.kiri = {};
|
||||
if (self.kiri.Layer) return;
|
||||
|
||||
var KIRI = self.kiri,
|
||||
let KIRI = self.kiri,
|
||||
LP = Layer.prototype,
|
||||
mcache = {};
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ var gs_kiri_layer = exports;
|
|||
KIRI.newLayer = function(view) { return new Layer(view) };
|
||||
|
||||
function materialFor(color) {
|
||||
var m = mcache[color];
|
||||
let m = mcache[color];
|
||||
if (!m) {
|
||||
m = mcache[color] = new THREE.LineBasicMaterial({
|
||||
fog: false,
|
||||
|
|
@ -33,12 +33,12 @@ var gs_kiri_layer = exports;
|
|||
}
|
||||
|
||||
function addPoly(arr, poly, deep, open) {
|
||||
var points = poly.points,
|
||||
let points = poly.points,
|
||||
len = points.length;
|
||||
|
||||
if (len < 2) return;
|
||||
|
||||
var doOpen = (open === undefined || open === null) ? poly.isOpen() : open,
|
||||
let doOpen = (open === undefined || open === null) ? poly.isOpen() : open,
|
||||
end = doOpen ? len - 1 : len,
|
||||
last = toVector(points[0]),
|
||||
i = 0;
|
||||
|
|
@ -75,13 +75,13 @@ var gs_kiri_layer = exports;
|
|||
};
|
||||
|
||||
LP.add = function(color, obj) {
|
||||
var ca = this.bycolor[color];
|
||||
let ca = this.bycolor[color];
|
||||
if (!ca) ca = this.bycolor[color] = [];
|
||||
ca.push(obj);
|
||||
};
|
||||
|
||||
LP.poly = function(poly, color, deep, open) {
|
||||
var layer = this;
|
||||
let layer = this;
|
||||
if (Array.isArray(poly)) {
|
||||
poly.forEach(function(p) { layer.poly(p, color, deep, open) });
|
||||
} else {
|
||||
|
|
@ -91,7 +91,7 @@ var gs_kiri_layer = exports;
|
|||
};
|
||||
|
||||
LP.points = function(points, color, size, opacity) {
|
||||
var layer = this,
|
||||
let layer = this,
|
||||
sz = size/2;
|
||||
points.forEach(function(p) {
|
||||
layer.lines([
|
||||
|
|
@ -135,15 +135,16 @@ var gs_kiri_layer = exports;
|
|||
if (this.group) this.view.remove(this.group);
|
||||
this.group = this.view.newGroup();
|
||||
|
||||
var bycolor = this.bycolor,
|
||||
let bycolor = this.bycolor,
|
||||
key, added;
|
||||
|
||||
for (key in bycolor) {
|
||||
if (!bycolor.hasOwnProperty(key)) continue;
|
||||
|
||||
var geo = new THREE.Geometry(),
|
||||
let geo = new THREE.Geometry(),
|
||||
arr = geo.vertices,
|
||||
mat = materialFor(parseInt(key));
|
||||
|
||||
added = bycolor[key];
|
||||
|
||||
added.forEach(function(obj) {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ var gs_kiri_slicer = exports;
|
|||
i, j = 0, k, p1, p2, p3, px,
|
||||
CPRO = KIRI.driver.CAM.process;
|
||||
|
||||
if (options.add) zMax += zInc;
|
||||
|
||||
function countZ(z) {
|
||||
z = UTIL.round(z,5);
|
||||
zList[z] = (zList[z] || 0) + 1;
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ var gs_moto_ui = exports;
|
|||
size = options ? options.size || 5 : 5,
|
||||
height = options ? options.height : 0,
|
||||
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
|
||||
action = inputAction;
|
||||
action = options.action || inputAction;
|
||||
|
||||
row.appendChild(newLabel(label));
|
||||
row.appendChild(ip);
|
||||
|
|
|
|||
Loading…
Reference in a new issue