add base flatten option for belt

This commit is contained in:
Stewart Allen 2021-09-05 20:42:18 -04:00
commit cf2b282b57
5 changed files with 15 additions and 23 deletions

View file

@ -350,6 +350,7 @@
firstLayerBeltLead: 3,
firstLayerBeltBump: 0,
firstLayerFanSpeed: 0,
firstLayerFlatten: 0,
outputRaft: false,
outputRaftSpacing: 0.2,
outputTemp: 200,

View file

@ -1696,6 +1696,7 @@
firstLayerFanSpeed: UC.newInput(LANG.ou_fans_s, {title:LANG.ou_fans_l, convert:UC.toInt, bound:UC.bound(0,255), modes:FDM}),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}),
firstLayerYOffset: UC.newInput(LANG.fl_zoff_s, {title:LANG.fl_zoff_l, convert:UC.toFloat, modes:FDM, show:isBelt}),
firstLayerFlatten: UC.newInput(LANG.fl_flat_s, {title:LANG.fl_flat_l, convert:UC.toFloat, modes:FDM, show:isBelt}),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isBelt}),
firstLayerRate: UC.newInput(LANG.fl_rate_s, {title:LANG.fl_rate_l, convert:UC.toFloat, modes:FDM}),
firstLayerFillRate: UC.newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:UC.toFloat, modes:FDM, show:isNotBelt}),

View file

@ -56,47 +56,35 @@
function slice(points, bounds, options, ondone, onupdate) {
let useFlats = options.flats,
isBelt = options.isBelt || false,
zPress = options.zPress || 0, // compress z values less than zPress (flaten bottom)
zPress = options.zPress || 0, // lower z values less than zPress (flaten bottoms)
zCut = options.zCut || 0, // cut bottom off model below bed/belt
xray = options.xray,
zList = {}, // map count of z index points for adaptive slicing
ox = 0,
oy = 0;
// support moving parts below bed to "cut" them
// and/or flatten part bottoms
let zpress = 0;
let zneg = 0;
// support moving parts below bed to "cut" them in Z
// and/or flatten part bottoms belowa a given thresold
if (zCut || zPress) {
for (let p of points) {
if (!p._z) {
p._z = p.z;
if (zPress) {
if (isBelt) {
let z = (p.z - p.y);
let zo = z * ibeltfact;
let zb = z * beltfact;
if (z < 0) zneg++;
if (zo > 0 && zo < zPress) {
p.y += z;
p.z -= z;
zpress++;
let zb = (p.z - p.y) * beltfact;
if (zb > 0 && zb <= zPress) {
p.y += zb * beltfact;
p.z -= zb * beltfact;
}
countZ(zo);
} else {
if (p.z < zPress) p.z = 0;
if (p.z <= zPress) p.z = 0;
}
}
if (zCut) {
if (zCut && !isBelt) {
p.z -= zCut;
}
}
}
}
console.log({zpress, zneg});
console.log({
zList: Object.entries(zList).sort((a,b) => { return parseFloat(a[0]) - parseFloat(b[0]) })
});
let zMin = options.zmin || options.firstHeight || Math.floor(bounds.min.z),
zMax = options.zmax || Math.ceil(bounds.max.z),
@ -108,7 +96,7 @@
zIndexes = [], // auto-detected z slicing offsets (laser/cam)
zOrdered = [], // ordered list of Z indexes
zThick = [], // ordered list of Z slice thickness (laser)
// zList = {}, // map count of z index points for adaptive slicing
zList = {}, // map count of z index points for adaptive slicing
zFlat = {}, // map area of z index flat areas (cam)
zLines = {}, // map count of z index lines
zScale, // bucket span in z units

View file

@ -179,7 +179,7 @@
SLICER.sliceWidget(widget, {
mode: 'FDM',
zCut: widget.track.zcut || 0,
zPress: 1,//0.05,
zPress: isBelt ? process.firstLayerFlatten || 0 : 0,
isBelt,
height: sliceHeight,
minHeight: sliceMinHeight,

View file

@ -331,6 +331,8 @@ kiri.lang['en-us'] = {
// FDM BELT ONLY
fl_zoff_s: "belt offset",
fl_zoff_l: ["height offset from belt","of lowest extrusion","in millimeters"],
fl_flat_s: "flatten",
fl_flat_l: ["flatten to the belt any point","height less than this value","in millimeters"],
fl_brim_s: "brim sides",
fl_brim_l: ["add brim to part perimeter","size is width in millimeters","0 to disable"],
fl_brin_s: "brim interior",