add sla slice fill

This commit is contained in:
Stewart Allen 2020-04-17 14:20:49 -04:00
commit f6e816863b
4 changed files with 55 additions and 16 deletions

View file

@ -315,6 +315,7 @@ let gs_kiri_conf = exports;
slaBaseOn: 30, slaBaseOn: 30,
slaBasePeelDist: 6, slaBasePeelDist: 6,
slaBasePeelLiftRate: 1.5, slaBasePeelLiftRate: 1.5,
slaFillDensity: 0,
slaFirstOffset: 0 slaFirstOffset: 0
} }
}, },

View file

@ -112,12 +112,53 @@ let gs_kiri_sla = exports;
slice.solids.unioned = slice.gatherTopPolys([]); slice.solids.unioned = slice.gatherTopPolys([]);
}) })
} }
if (process.slaFillDensity) {
forSlices(slices, 0.9, 1.0, (slice) => {
fillPolys(slice, settings);
});
}
ondone(); ondone();
}, function(update) { }, function(update) {
return onupdate(0.0 + update * 0.5); return onupdate(0.0 + update * 0.5);
}); });
}; };
function fillPolys(slice, settings) {
let process = settings.process,
device = settings.device,
density = process.slaFillDensity,
polys = slice.solids.unioned,
bounds = settings.bounds,
width = bounds.max.x - bounds.min.x,
depth = bounds.max.y - bounds.min.y,
fill = [];
for (let x=0; x<5; x++) {
fill.push(
BASE.newPolygon().centerRectangle({
x: x * (width/20) - (width/2),
y: 0,
z: slice.z
}, width/20, depth/20)
);
}
for (let y=0; y<5; y++) {
fill.push(
BASE.newPolygon().centerRectangle({
x: 0,
y: y * (depth/20) - (depth/2),
z: slice.z
}, width/20, depth/20)
);
}
let clip = POLY.trimTo(fill, slice.tops.map(t => t.poly));
let union = slice.solids.unioned.appendAll(clip);
slice.solids.unioned = POLY.union(union);
// console.log(slice.index, clip, union, slice.solids.unioned);
}
/** /**
* DRIVER PRINT CONTRACT - runs in worker * DRIVER PRINT CONTRACT - runs in worker
* @param {Object} print state object * @param {Object} print state object
@ -249,7 +290,7 @@ let gs_kiri_sla = exports;
} }
let polys = slice.solids.unioned; let polys = slice.solids.unioned;
polys.forEach(poly => { polys.forEach(poly => {
layer.poly(poly, 0, true); layer.poly(poly, 0x010101, true);
layer.solid(poly, 0x00bbee); layer.solid(poly, 0x00bbee);
count++; count++;
}); });
@ -480,12 +521,10 @@ let gs_kiri_sla = exports;
bitsDV.setUint8(i, lineDV.getUint8(i * 4) > 0 ? 1 : 0); bitsDV.setUint8(i, lineDV.getUint8(i * 4) > 0 ? 1 : 0);
} }
progress(index / conf.lines.length); progress(index / conf.lines.length);
return { return { subs: [{
subs: [{ exposureTime: process.slaLayerOn,
exposureTime: process.slaLayerOn, data: bits
data: bits }] };
}]
};
}); });
let coded = encodeLayers(converted, "photons"); let coded = encodeLayers(converted, "photons");
@ -536,8 +575,7 @@ let gs_kiri_sla = exports;
} }
function encodeLayers(input, type) { function encodeLayers(input, type) {
let layers = [], let layers = [], length = 0;
length = 0;
for (let index = 0; index < input.length; index++) { for (let index = 0; index < input.length; index++) {
let subs = input[index].subs, let subs = input[index].subs,
sublayers = [], sublayers = [],
@ -555,10 +593,7 @@ let gs_kiri_sla = exports;
sublayers sublayers
}); });
} }
return { return { length, layers };
length,
layers
};
} }
function rleEncode(data, type) { function rleEncode(data, type) {
@ -589,7 +624,6 @@ let gs_kiri_sla = exports;
function rleByte(color, length, type) { function rleByte(color, length, type) {
switch (type) { switch (type) {
case 'pws':
case 'photon': case 'photon':
return (length & 0x7f) | ((color << 7) & 0x80); return (length & 0x7f) | ((color << 7) & 0x80);
case 'photons': case 'photons':

View file

@ -313,7 +313,7 @@ var gs_kiri_init = exports;
API.function.slice(); API.function.slice();
break; break;
case cca('p'): // prepare print case cca('p'): // prepare print
if (API.mode.get() !== 'SLA') { if (!API.conf.isSliceSkipped()) {
API.function.print(); API.function.print();
} }
break; break;
@ -1473,6 +1473,9 @@ var gs_kiri_init = exports;
slaFirst: UC.newGroup('first layer', null, {modes:SLA, group:"sla-first", expert:true}), slaFirst: UC.newGroup('first layer', null, {modes:SLA, group:"sla-first", expert:true}),
slaFirstOffset: UC.newInput('offset', {title:'first layer offset\nalmost always 0.0\n0.0-1.0 in millimeters', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA, expert:true}), slaFirstOffset: UC.newInput('offset', {title:'first layer offset\nalmost always 0.0\n0.0-1.0 in millimeters', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA, expert:true}),
slaFill: UC.newGroup('infill', null, {modes:SLA, group:"sla-first"}),
slaFillDensity: UC.newInput('density', {title:'percent infill\n0.0-1.0', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA}),
}); });
if (!lang_set) { if (!lang_set) {

View file

@ -158,7 +158,8 @@ self.kiri.copyright = exports.COPYRIGHT;
update: updateSettings, update: updateSettings,
restore: restoreSettings, restore: restoreSettings,
export: settingsExport, export: settingsExport,
import: settingsImport import: settingsImport,
isSliceSkipped: () => { return skipSliceView }
}, },
color, color,
const: { const: {