fix clone error. only perform route around if intersection detected
This commit is contained in:
parent
47d907dbba
commit
f6dd5312b9
3 changed files with 10 additions and 7 deletions
|
|
@ -568,9 +568,6 @@
|
||||||
if (slice.index < 0) {
|
if (slice.index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (opt.danger) {
|
|
||||||
return retractRequired(p1, p2);
|
|
||||||
}
|
|
||||||
let int = false;
|
let int = false;
|
||||||
slice.topPolysFlat().forEach(function(poly) {
|
slice.topPolysFlat().forEach(function(poly) {
|
||||||
if (!int) poly.forEachSegment(function(s1, s2) {
|
if (!int) poly.forEachSegment(function(s1, s2) {
|
||||||
|
|
@ -579,12 +576,16 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// if intersecting, look for a route around
|
||||||
|
if (int && opt.danger) {
|
||||||
|
return !routeAround(p1, p2);
|
||||||
|
}
|
||||||
return int;
|
return int;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if no path around and retract required
|
// returns true if no path around and retract required
|
||||||
// returns false if routed around or no retract
|
// returns false if routed around or no retract
|
||||||
function retractRequired(p1, p2) {
|
function routeAround(p1, p2) {
|
||||||
const dbug = false;
|
const dbug = false;
|
||||||
|
|
||||||
if (dbug === slice.index) console.log(slice.index, {p1, p2, d: p1.distTo2D(p2)});
|
if (dbug === slice.index) console.log(slice.index, {p1, p2, d: p1.distTo2D(p2)});
|
||||||
|
|
@ -632,6 +633,7 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// mark invalid intersect pairs (low or zero dist, etc)
|
// mark invalid intersect pairs (low or zero dist, etc)
|
||||||
|
// TODO: only if this is the outer pair and there are closer inner pairs
|
||||||
if (i1.ip.distTo2D(i2.ip) < retractDist) {
|
if (i1.ip.distTo2D(i2.ip) < retractDist) {
|
||||||
if (dbug === slice.index) console.log(slice.index, {int_dist_too_small: i1.ip.distTo2D(i2.ip), retractDist});
|
if (dbug === slice.index) console.log(slice.index, {int_dist_too_small: i1.ip.distTo2D(i2.ip), retractDist});
|
||||||
ints[i] = undefined;
|
ints[i] = undefined;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@
|
||||||
if (this.topFlatPolys) {
|
if (this.topFlatPolys) {
|
||||||
return this.topFlatPolys;
|
return this.topFlatPolys;
|
||||||
}
|
}
|
||||||
return this.topFlatPolys = POLY.flatten(this.topPolys()).clone(true);
|
return this.topFlatPolys = POLY.flatten(this.topPolys().clone(true), [], true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// FDM retract path routing using first shell
|
// FDM retract path routing using first shell
|
||||||
|
|
@ -119,7 +119,8 @@
|
||||||
if (this.topFlatRoutes) {
|
if (this.topFlatRoutes) {
|
||||||
return this.topFlatRoutes;
|
return this.topFlatRoutes;
|
||||||
}
|
}
|
||||||
return this.topFlatRoutes = POLY.flatten(this.tops.map(top => top.shells[0]).clone(true), [], true);
|
let topShells0 = this.tops.map(top => top.shells[0]).filter(p => p);
|
||||||
|
return this.topFlatRoutes = POLY.flatten(topShells0.clone(true), [], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CAM only
|
// CAM only
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,7 @@
|
||||||
.setLayer("gaps", COLOR.gaps)
|
.setLayer("gaps", COLOR.gaps)
|
||||||
.addPolys(top.gaps, vopt({ offset, height, thin: true }));
|
.addPolys(top.gaps, vopt({ offset, height, thin: true }));
|
||||||
|
|
||||||
if (isThin && devel) {
|
if (isThin && devel && top.fill_off && top.fill_off.length) {
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer('fill inset', { face: 0, line: 0xaaaaaa, check: 0xaaaaaa })
|
.setLayer('fill inset', { face: 0, line: 0xaaaaaa, check: 0xaaaaaa })
|
||||||
.addPolys(top.fill_off);
|
.addPolys(top.fill_off);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue