add strict closing rule for fdm, laser slicing

This commit is contained in:
Stewart Allen 2025-12-25 22:57:14 -05:00
commit 97a3edf039
3 changed files with 7 additions and 0 deletions

View file

@ -565,6 +565,11 @@ export function sliceConnect(input, z, opt = {}) {
// emit a polygon if it can be cleaned and still have 2 or more points
function emit(poly) {
let gap = poly.first().distTo2D(poly.last());
if (opt.strict && gap > bridgeMax) {
if (debug) console.log('drop', gap, poly);
return;
}
emitted += poly.length;
if (!opt.dirty) poly = poly.clean();
if (poly.length > 2 || true) output.push(poly);

View file

@ -222,6 +222,7 @@ export function fdm_slice(settings, widget, onupdate, ondone) {
}
slice(points, {
strict: true,
debug: process.xray,
xray: process.xray,
zMin: bounds.min.z,

View file

@ -191,6 +191,7 @@ function laser_slice(settings, widget, onupdate, ondone) {
let indices = [];
slicer.slice(points, {
strict: true,
zMin: bounds.min.z,
zMax: bounds.max.z,
zGen(zopt) {