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