experimental new form of thin wall handling
This commit is contained in:
parent
acc773e9d7
commit
3c4a282f67
2 changed files with 40 additions and 7 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
expand,
|
expand,
|
||||||
expand_lines,
|
expand_lines,
|
||||||
union,
|
union,
|
||||||
|
inset,
|
||||||
nest,
|
nest,
|
||||||
diff,
|
diff,
|
||||||
setZ,
|
setZ,
|
||||||
|
|
@ -540,6 +541,22 @@
|
||||||
return opts.flat ? opts.outs : polys;
|
return opts.flat ? opts.outs : polys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inset(polys, dist, count, z) {
|
||||||
|
let total = count;
|
||||||
|
let layers = [];
|
||||||
|
let ref = polys;
|
||||||
|
while (count-- > 0 && ref && ref.length) {
|
||||||
|
let off = offset(ref, -dist, {z});
|
||||||
|
let mid = offset(off, dist / 2, {z});
|
||||||
|
let cmp = offset(off, dist, {z});
|
||||||
|
let gap = [];
|
||||||
|
subtract(ref, cmp, gap, null, z);
|
||||||
|
layers.push({idx: total-count, off, mid, gap});
|
||||||
|
ref = off;
|
||||||
|
}
|
||||||
|
return layers;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo use clipper opne poly clipping?
|
* todo use clipper opne poly clipping?
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
FDM.slice = function(settings, widget, onupdate, ondone) {
|
FDM.slice = function(settings, widget, onupdate, ondone) {
|
||||||
FDM.fixExtruders(settings);
|
FDM.fixExtruders(settings);
|
||||||
let render = settings.render !== false,
|
let render = settings.render !== false,
|
||||||
|
ctrl = settings.controller,
|
||||||
spro = settings.process,
|
spro = settings.process,
|
||||||
sdev = settings.device,
|
sdev = settings.device,
|
||||||
isBelt = sdev.bedBelt,
|
isBelt = sdev.bedBelt,
|
||||||
|
|
@ -85,8 +86,8 @@
|
||||||
beltfact = Math.cos(Math.PI/4),
|
beltfact = Math.cos(Math.PI/4),
|
||||||
invbfact = 1 / beltfact;
|
invbfact = 1 / beltfact;
|
||||||
|
|
||||||
isFlat = settings.controller.lineType === "flat";
|
isFlat = ctrl.lineType === "flat";
|
||||||
isThin = !isFlat && settings.controller.lineType === "line";
|
isThin = !isFlat && ctrl.lineType === "line";
|
||||||
offset = lineWidth / 2;
|
offset = lineWidth / 2;
|
||||||
|
|
||||||
if (isFlat) {
|
if (isFlat) {
|
||||||
|
|
@ -151,7 +152,7 @@
|
||||||
height: sliceHeight,
|
height: sliceHeight,
|
||||||
minHeight: sliceMinHeight,
|
minHeight: sliceMinHeight,
|
||||||
firstHeight: firstSliceHeight,
|
firstHeight: firstSliceHeight,
|
||||||
union: settings.controller.healMesh,
|
union: ctrl.healMesh,
|
||||||
// debug: true,
|
// debug: true,
|
||||||
// xray: 3,
|
// xray: 3,
|
||||||
// view: view
|
// view: view
|
||||||
|
|
@ -289,7 +290,8 @@
|
||||||
doShells(slice, count, offset, fillOff, {
|
doShells(slice, count, offset, fillOff, {
|
||||||
vase: vaseMode,
|
vase: vaseMode,
|
||||||
thin: spro.detectThinWalls && !isSynth,
|
thin: spro.detectThinWalls && !isSynth,
|
||||||
widget: widget
|
widget: widget,
|
||||||
|
danger: ctrl.danger
|
||||||
});
|
});
|
||||||
if (solid) {
|
if (solid) {
|
||||||
let fillSpace = fillSpacing * spaceMult;
|
let fillSpace = fillSpacing * spaceMult;
|
||||||
|
|
@ -569,7 +571,23 @@
|
||||||
let dist = p.first().distTo2D(p.last());
|
let dist = p.first().distTo2D(p.last());
|
||||||
if (dist < 1) p.open = false;
|
if (dist < 1) p.open = false;
|
||||||
} });
|
} });
|
||||||
if (opt.thin) {
|
|
||||||
|
if (opt.danger && opt.thin) {
|
||||||
|
top.thin_fill = [];
|
||||||
|
let layers = POLY.inset(top_poly, offsetN, count, z);
|
||||||
|
last = layers.last().mid;
|
||||||
|
top.shells = layers.map(r => r.mid).flat();
|
||||||
|
layers.map(r => r.gap).forEach((polys, i) => {
|
||||||
|
let off = offset1;
|
||||||
|
polys = POLY.offset(polys, -off * 0.8, {z, minArea: 0});
|
||||||
|
if (polys.length) {
|
||||||
|
top.thin_fill.appendAll(cullIntersections(
|
||||||
|
fillArea(polys, 45, off/2, []),//, 0.01, off*2),
|
||||||
|
fillArea(polys, 135, off/2, [])//, 0.01, off*2),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (opt.thin) {
|
||||||
top.thin_fill = [];
|
top.thin_fill = [];
|
||||||
let oso = {z, count, gaps: [], outs: [], minArea: 0.05};
|
let oso = {z, count, gaps: [], outs: [], minArea: 0.05};
|
||||||
POLY.offset(top_poly, [-offset1, -offsetN], oso);
|
POLY.offset(top_poly, [-offset1, -offsetN], oso);
|
||||||
|
|
@ -593,8 +611,6 @@
|
||||||
top.thin_fill.appendAll(cullIntersections(
|
top.thin_fill.appendAll(cullIntersections(
|
||||||
fillArea(polys, 45, off/2, [], 0.01, off*2),
|
fillArea(polys, 45, off/2, [], 0.01, off*2),
|
||||||
fillArea(polys, 135, off/2, [], 0.01, off*2),
|
fillArea(polys, 135, off/2, [], 0.01, off*2),
|
||||||
// fillArea(polys, 90, off, [], 0.05, off*4),
|
|
||||||
// fillArea(polys, 180, off, [], 0.05, off*4),
|
|
||||||
));
|
));
|
||||||
gaps = polys;
|
gaps = polys;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue