checkpoint sla support work
This commit is contained in:
parent
0b87e3bdbd
commit
ec8fbc0a5f
6 changed files with 71 additions and 14 deletions
|
|
@ -803,7 +803,6 @@ var gs_kiri_cam = exports;
|
||||||
sliceDepth = MAX(0.1, MIN(proc.roughingDown, proc.finishingDown) / 3) * units,
|
sliceDepth = MAX(0.1, MIN(proc.roughingDown, proc.finishingDown) / 3) * units,
|
||||||
pocketOnlyRough = proc.camPocketOnlyRough,
|
pocketOnlyRough = proc.camPocketOnlyRough,
|
||||||
pocketOnlyFinish = proc.camPocketOnlyFinish,
|
pocketOnlyFinish = proc.camPocketOnlyFinish,
|
||||||
// addTabs = proc.camTabsOn && !pocketOnly,
|
|
||||||
addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough,
|
addTabsRough = procRough && proc.camTabsOn && !pocketOnlyRough,
|
||||||
addTabsFinish = procFinish && proc.camTabsOn && !pocketOnlyFinish,
|
addTabsFinish = procFinish && proc.camTabsOn && !pocketOnlyFinish,
|
||||||
tabWidth = proc.camTabsWidth * units,
|
tabWidth = proc.camTabsWidth * units,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ let gs_kiri_sla = exports;
|
||||||
POLY = BASE.polygons,
|
POLY = BASE.polygons,
|
||||||
SLA = KIRI.driver.SLA = {
|
SLA = KIRI.driver.SLA = {
|
||||||
slice,
|
slice,
|
||||||
|
sliceRender,
|
||||||
printSetup,
|
printSetup,
|
||||||
printExport,
|
printExport,
|
||||||
printDownload,
|
printDownload,
|
||||||
|
|
@ -82,23 +83,26 @@ let gs_kiri_sla = exports;
|
||||||
}
|
}
|
||||||
// insert support layers
|
// insert support layers
|
||||||
if (process.slaSupportLayers) {
|
if (process.slaSupportLayers) {
|
||||||
let zoff = height / 2;
|
let zoff = height / 2,
|
||||||
let snew = [];
|
snew = [],
|
||||||
let polys = [];
|
polys = [];
|
||||||
let outer = slices.forEach(slice => {
|
let outer = slices.forEach(slice => {
|
||||||
polys.appendAll(slice.tops.map(t => t.poly));
|
polys.appendAll(slice.tops.map(t => t.poly));
|
||||||
});
|
});
|
||||||
let union = POLY.expand(POLY.union(polys), 2, zoff, [], 1);
|
let union = POLY.expand(POLY.union(polys), 2, zoff, [], 1);
|
||||||
for (let s=0; s<process.slaSupportLayers; s++) {
|
for (let s=0; s<process.slaSupportLayers + 3; s++) {
|
||||||
let slice = newSlice(zoff);
|
let slice = newSlice(zoff);
|
||||||
|
slice.synth = true;
|
||||||
slice.height = height;
|
slice.height = height;
|
||||||
slice.index = snew.length;
|
slice.index = snew.length;
|
||||||
|
if (s < process.slaSupportLayers) {
|
||||||
union.forEach(u => {
|
union.forEach(u => {
|
||||||
slice.tops.push(newTop(u.clone(true).setZ(zoff)));
|
slice.tops.push(newTop(u.clone(true).setZ(zoff)));
|
||||||
});
|
});
|
||||||
|
union = POLY.expand(union, 0.1, zoff, [], 1);
|
||||||
|
}
|
||||||
snew.push(slice);
|
snew.push(slice);
|
||||||
zoff += height;
|
zoff += height;
|
||||||
union = POLY.expand(union, 0.1, zoff, [], 1);
|
|
||||||
}
|
}
|
||||||
widget.slices = slices = snew.concat(slices.map(s => {
|
widget.slices = slices = snew.concat(slices.map(s => {
|
||||||
s.tops.forEach(t => {
|
s.tops.forEach(t => {
|
||||||
|
|
@ -125,14 +129,17 @@ let gs_kiri_sla = exports;
|
||||||
}
|
}
|
||||||
}, "slice");
|
}, "slice");
|
||||||
forSlices(slices, 0.1, 0.2, (slice) => {
|
forSlices(slices, 0.1, 0.2, (slice) => {
|
||||||
|
if (slice.synth) return;
|
||||||
slice.doDiff(0.00001, 0.005, !process.slaOpenBase);
|
slice.doDiff(0.00001, 0.005, !process.slaOpenBase);
|
||||||
}, "delta");
|
}, "delta");
|
||||||
if (solidLayers) {
|
if (solidLayers) {
|
||||||
forSlices(slices, 0.2, 0.3, (slice) => {
|
forSlices(slices, 0.2, 0.3, (slice) => {
|
||||||
|
if (slice.synth) return;
|
||||||
slice.projectFlats(solidLayers);
|
slice.projectFlats(solidLayers);
|
||||||
slice.projectBridges(solidLayers);
|
slice.projectBridges(solidLayers);
|
||||||
}, "project");
|
}, "project");
|
||||||
forSlices(slices, 0.3, 0.4, (slice) => {
|
forSlices(slices, 0.3, 0.4, (slice) => {
|
||||||
|
if (slice.synth) return;
|
||||||
slice.doSolidsFill(undefined, undefined, 0.001);
|
slice.doSolidsFill(undefined, undefined, 0.001);
|
||||||
let traces = POLY.nest(POLY.flatten(slice.gatherTraces([])));
|
let traces = POLY.nest(POLY.flatten(slice.gatherTraces([])));
|
||||||
let trims = slice.solids.trimmed || [];
|
let trims = slice.solids.trimmed || [];
|
||||||
|
|
@ -142,12 +149,14 @@ let gs_kiri_sla = exports;
|
||||||
}, "solid");
|
}, "solid");
|
||||||
} else {
|
} else {
|
||||||
forSlices(slices, 0.2, 0.4, (slice) => {
|
forSlices(slices, 0.2, 0.4, (slice) => {
|
||||||
|
if (slice.synth) return;
|
||||||
slice.solids.unioned = slice.gatherTopPolys([]);
|
slice.solids.unioned = slice.gatherTopPolys([]);
|
||||||
}, "solid");
|
}, "solid");
|
||||||
}
|
}
|
||||||
if (process.slaFillDensity && process.slaShell) {
|
if (process.slaFillDensity && process.slaShell) {
|
||||||
fill_cache = [];
|
fill_cache = [];
|
||||||
forSlices(slices, 0.4, 1.0, (slice) => {
|
forSlices(slices, 0.4, 1.0, (slice) => {
|
||||||
|
if (slice.synth) return;
|
||||||
fillPolys(slice, settings);
|
fillPolys(slice, settings);
|
||||||
}, "infill");
|
}, "infill");
|
||||||
}
|
}
|
||||||
|
|
@ -260,8 +269,10 @@ let gs_kiri_sla = exports;
|
||||||
widgets.forEach(widget => {
|
widgets.forEach(widget => {
|
||||||
let slice = widget.slices[index];
|
let slice = widget.slices[index];
|
||||||
if (slice) {
|
if (slice) {
|
||||||
let traces = POLY.flatten(slice.gatherTraces([]));
|
// prevent premature exit on empty synth slice
|
||||||
|
if (slice.synth) count++;
|
||||||
let polys = slice.solids.unioned;
|
let polys = slice.solids.unioned;
|
||||||
|
if (!polys) polys = slice.tops.map(t => t.poly);
|
||||||
polys.forEach(poly => {
|
polys.forEach(poly => {
|
||||||
poly.move(widget.track.pos);
|
poly.move(widget.track.pos);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
|
@ -347,6 +358,40 @@ let gs_kiri_sla = exports;
|
||||||
console.log('print.export', Date.now() - mark);
|
console.log('print.export', Date.now() - mark);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// runs in browser main
|
||||||
|
function sliceRender(widget) {
|
||||||
|
widget.slices.forEach(slice => {
|
||||||
|
let layers = slice.layers,
|
||||||
|
outline = layers.outline,
|
||||||
|
support = layers.support;
|
||||||
|
|
||||||
|
if (slice.solids.unioned) {
|
||||||
|
slice.solids.unioned.forEach(poly => {
|
||||||
|
poly = poly.clone(true).move(widget.track.pos);
|
||||||
|
outline.poly(poly, 0x010101, true);
|
||||||
|
outline.solid(poly, 0x0099cc);
|
||||||
|
});
|
||||||
|
} else if (slice.tops) {
|
||||||
|
slice.tops.forEach(top => {
|
||||||
|
outline.poly(top.poly, 0x010101, true, false);
|
||||||
|
outline.solid(top.poly, 0xeeee55);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slice.supports)
|
||||||
|
slice.supports.forEach(poly => {
|
||||||
|
layer.poly(poly, 0x010105, true, false);
|
||||||
|
layer.solid(poly, 0xffff99);
|
||||||
|
});
|
||||||
|
|
||||||
|
slice.renderDiff();
|
||||||
|
slice.renderSolidOutlines();
|
||||||
|
|
||||||
|
outline.renderAll();
|
||||||
|
support.renderAll();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// runs in browser main
|
// runs in browser main
|
||||||
function printRender(print) {
|
function printRender(print) {
|
||||||
let widgets = print.widgets,
|
let widgets = print.widgets,
|
||||||
|
|
@ -363,12 +408,13 @@ let gs_kiri_sla = exports;
|
||||||
if (!slice) {
|
if (!slice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
let polys = slice.solids.unioned;
|
let polys = slice.solids.unioned;
|
||||||
|
if (!polys) polys = slice.tops.map(t => t.poly);
|
||||||
polys.forEach(poly => {
|
polys.forEach(poly => {
|
||||||
poly = poly.clone(true).move(widget.track.pos);
|
poly = poly.clone(true).move(widget.track.pos);
|
||||||
layer.poly(poly, 0x010101, true);
|
layer.poly(poly, 0x010101, true);
|
||||||
layer.solid(poly, 0x0099cc);
|
layer.solid(poly, 0x0099cc);
|
||||||
count++;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1300,7 +1300,7 @@ var gs_kiri_init = exports;
|
||||||
layerSolid: UC.newBoolean(LANG.la_slds, onLayerToggle, {modes:FDM_SLA}),
|
layerSolid: UC.newBoolean(LANG.la_slds, onLayerToggle, {modes:FDM_SLA}),
|
||||||
layerFill: UC.newBoolean(LANG.la_fill, onLayerToggle, {modes:FDM}),
|
layerFill: UC.newBoolean(LANG.la_fill, onLayerToggle, {modes:FDM}),
|
||||||
layerSparse: UC.newBoolean(LANG.la_sprs, onLayerToggle, {modes:FDM}),
|
layerSparse: UC.newBoolean(LANG.la_sprs, onLayerToggle, {modes:FDM}),
|
||||||
layerSupport: UC.newBoolean(LANG.la_sprt, onLayerToggle, {modes:FDM}),
|
layerSupport: UC.newBoolean(LANG.la_sprt, onLayerToggle, {modes:FDM_SLA}),
|
||||||
layerPrint: UC.newBoolean(LANG.la_prnt, onLayerToggle),
|
layerPrint: UC.newBoolean(LANG.la_prnt, onLayerToggle),
|
||||||
layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle, {modes:GCODE}),
|
layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle, {modes:GCODE}),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,11 @@ let gs_kiri_layer = exports;
|
||||||
this.changed = true;
|
this.changed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LP.renderAll = function() {
|
||||||
|
this.renderSolid();
|
||||||
|
this.render();
|
||||||
|
};
|
||||||
|
|
||||||
LP.renderSolid = function() {
|
LP.renderSolid = function() {
|
||||||
if (!(this.view)) return;
|
if (!(this.view)) return;
|
||||||
if (this.solids) this.view.remove(this.solids);
|
if (this.solids) this.view.remove(this.solids);
|
||||||
|
|
|
||||||
|
|
@ -717,7 +717,14 @@ let gs_kiri_widget = exports;
|
||||||
PRO.render = function(renderMode, cam) {
|
PRO.render = function(renderMode, cam) {
|
||||||
let slices = this.slices;
|
let slices = this.slices;
|
||||||
if (!slices) return;
|
if (!slices) return;
|
||||||
let extruder = this.getExtruder(this.settings);
|
|
||||||
|
let settings = this.settings,
|
||||||
|
driver = DRIVERS[settings.mode.toUpperCase()];
|
||||||
|
|
||||||
|
// allow driver to override widget slice rendering (new in SLA)
|
||||||
|
if (driver.sliceRender) return driver.sliceRender(this);
|
||||||
|
|
||||||
|
let extruder = this.getExtruder(settings);
|
||||||
// render outline
|
// render outline
|
||||||
slices.forEach(function(s) { s.renderOutline(renderMode,extruder) });
|
slices.forEach(function(s) { s.renderOutline(renderMode,extruder) });
|
||||||
// render shells
|
// render shells
|
||||||
|
|
|
||||||
|
|
@ -714,7 +714,7 @@ var MOTO = window.moto = window.moto || {};
|
||||||
new THREE.PlaneBufferGeometry(100000, 100000, 1, 1),
|
new THREE.PlaneBufferGeometry(100000, 100000, 1, 1),
|
||||||
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0, transparent: true, side:THREE.DoubleSide } )
|
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0, transparent: true, side:THREE.DoubleSide } )
|
||||||
);
|
);
|
||||||
trackPlane.visible = true;
|
trackPlane.visible = false;
|
||||||
trackPlane.rotation.x = PI2;
|
trackPlane.rotation.x = PI2;
|
||||||
|
|
||||||
let sky = new THREE.Mesh(
|
let sky = new THREE.Mesh(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue