add missing thin wall render
This commit is contained in:
parent
709336c36e
commit
e7a050e03e
7 changed files with 37 additions and 21 deletions
|
|
@ -157,7 +157,6 @@
|
|||
|
||||
registerDecoder('top', function(v, state) {
|
||||
let top = KIRI.newTop(decode(v.poly, state));
|
||||
|
||||
// top.traces = decode(v.traces, state);
|
||||
// top.inner = decode(v.inner, state);
|
||||
// // top.thinner = decode(v.thinner, state);
|
||||
|
|
@ -166,7 +165,6 @@
|
|||
// top.fill_lines = decodePointArray(v.fill_lines, state);
|
||||
// top.fill_sparse = decode(v.fill_sparse, state);
|
||||
// top.polish = decode(v.polish, state);
|
||||
|
||||
return top;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
VIEWS = CONF.VIEWS,
|
||||
clone = Object.clone,
|
||||
settings = clone(CONF.template),
|
||||
settingsDefault = clone(settings),
|
||||
// settingsDefault = clone(settings),
|
||||
// ---------------
|
||||
Widget = kiri.Widget,
|
||||
newWidget = kiri.newWidget,
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@
|
|||
|
||||
function intersectsTop(p1, p2) {
|
||||
let int = false;
|
||||
POLY.flatten(slice.gatherTopPolys([])).forEach(function(poly) {
|
||||
POLY.flatten(slice.topPolys().clone(true)).forEach(function(poly) {
|
||||
if (!int) poly.forEachSegment(function(s1, s2) {
|
||||
if (UTIL.intersect(p1,p2,s1,s2,BASE.key.SEGINT)) {
|
||||
int = true;
|
||||
|
|
@ -879,7 +879,7 @@
|
|||
}
|
||||
} else {
|
||||
// top object
|
||||
let bounds = POLY.flatten(next.gatherOuter([]));
|
||||
let bounds = POLY.flatten(next.shellsAtDepth(0));
|
||||
|
||||
let dir = -1; // 1 == inside out, -1 == outside-in
|
||||
|
||||
|
|
@ -888,7 +888,7 @@
|
|||
outputTraces([].appendAll(next.innerTraces() || []));
|
||||
|
||||
// sort perimeter polygon by length to go out-to-in or in-to-out
|
||||
(next.traces || []).sort(function(a,b) {
|
||||
(next.shells || []).sort(function(a,b) {
|
||||
return a.perimeter() > b.perimeter() ? dir : -dir;
|
||||
}).forEach(function(poly, index) {
|
||||
outputTraces(poly);
|
||||
|
|
|
|||
|
|
@ -69,17 +69,14 @@
|
|||
};
|
||||
|
||||
/**
|
||||
* Appends all outermost trace polygons into a given array
|
||||
* and returns it. used by Print
|
||||
* Returns shell polygons of a given depth
|
||||
* used by Print (FDM)
|
||||
*
|
||||
* @param {Polygon[]} out array to populate
|
||||
* @returns {Polygon[]} array of top polygons
|
||||
*/
|
||||
Top.prototype.gatherOuter = function(out) {
|
||||
this.traces.forEach(function(trace) {
|
||||
if (trace.depth === 0) out.append(trace);
|
||||
});
|
||||
return out;
|
||||
Top.prototype.shellsAtDepth = function(depth) {
|
||||
return this.shells.filter(poly => poly.depth === depth);
|
||||
};
|
||||
|
||||
/** ******************************************************************
|
||||
|
|
@ -161,17 +158,34 @@
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new top object given a polygon
|
||||
*
|
||||
* @param {Polygon} poly to add
|
||||
*/
|
||||
PRO.addTop = function(poly) {
|
||||
let top = new Top(poly);
|
||||
this.tops.push(top);
|
||||
return top;
|
||||
};
|
||||
|
||||
PRO.findClosestPointTo = function(target) {
|
||||
let min, find;
|
||||
|
||||
if (this.tops.length) {
|
||||
this.tops.forEach(function(top) {
|
||||
find = top.poly.findClosestPointTo(target);
|
||||
if (!min || find.distance < min.distance) {
|
||||
min = find;
|
||||
}
|
||||
});
|
||||
} else if (this.supports) {
|
||||
this.supports.forEach(function(poly) {
|
||||
find = poly.findClosestPointTo(target);
|
||||
if (!min || find.distance < min.distance) {
|
||||
min = find;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return min;
|
||||
};
|
||||
|
||||
function newTop(poly) {
|
||||
return new Top(poly);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
FDM.printRender = function(print, options) {
|
||||
let debug = KIRI.api.const.LOCAL;
|
||||
let scope = print, emits, last,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
let KIRI = self.kiri,
|
||||
BASE = self.base,
|
||||
UTIL = BASE.util,
|
||||
POLY = BASE.polygons,
|
||||
FDM = KIRI.driver.FDM,
|
||||
newPoint = BASE.newPoint;
|
||||
|
||||
|
|
@ -368,6 +369,8 @@
|
|||
layerout = [];
|
||||
lastOut = undefined;
|
||||
}
|
||||
|
||||
console.log({output});
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -444,6 +444,10 @@
|
|||
.setLayer("infill", COLOR.infill)
|
||||
.addPolys(top.fill_sparse, vopt({ offset, height, open: true, outline: true }))
|
||||
|
||||
if (top.thin_fill) output
|
||||
.setLayer("fill", COLOR.fill)
|
||||
.addLines(top.thin_fill, vopt({ offset, height }));
|
||||
|
||||
// emit solid areas
|
||||
// if (isThin && debug) {
|
||||
// output
|
||||
|
|
@ -607,8 +611,6 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const render = slice.output();
|
||||
|
||||
slice.tops.forEach(function(top) {
|
||||
const lines = fillArea(top.fill_off, angle, spacing, null);
|
||||
top.fill_lines.appendAll(lines);
|
||||
|
|
|
|||
Loading…
Reference in a new issue