improve performance of pocketed roughing by simplifying pancaked shell
This commit is contained in:
parent
ec5531dbe4
commit
051c5d6f7a
5 changed files with 19 additions and 6 deletions
|
|
@ -1028,12 +1028,17 @@ var gs_base_polygon = exports;
|
|||
* simplify and merge collinear. only works for single
|
||||
* non-nested polygons. used primarily in slicer/connectLines.
|
||||
*/
|
||||
PRO.clean = function() {
|
||||
var clib = self.ClipperLib,
|
||||
PRO.clean = function(deep, parent) {
|
||||
let clib = self.ClipperLib,
|
||||
clip = clib.Clipper,
|
||||
clean = clip.CleanPolygon(this.toClipper()[0], CONF.clipperClean),
|
||||
poly = fromClipperPath(clean, this.getZ());
|
||||
return poly;
|
||||
if (deep && this.inner) {
|
||||
poly.inner = this.inner.map(inr => inr.clean(false, poly));
|
||||
}
|
||||
poly.parent = parent || this.parent;
|
||||
poly.area2 = this.area2;
|
||||
return poly || this;
|
||||
};
|
||||
|
||||
PRO.toClipper = function(inout,debug) {
|
||||
|
|
|
|||
|
|
@ -490,6 +490,7 @@ var gs_base_polygons = exports;
|
|||
var simple = clip.SimplifyPolygons(clean, cpft.pftNonZero);
|
||||
coff.AddPaths(simple, cjnt.jtMiter, cety.etClosedPolygon);
|
||||
});
|
||||
|
||||
coff.Execute(ctre, (dist1 + over) * fact);
|
||||
polys = fromClipperTree(ctre, z);
|
||||
|
||||
|
|
|
|||
|
|
@ -903,6 +903,9 @@ var gs_kiri_cam = exports;
|
|||
if (procRough && !pocketOnlyRough) {
|
||||
// expand shell by half tool diameter + stock to leave
|
||||
shellRough = facePolys = POLY.expand(shellRough, (roughToolDiam / 2) + proc.roughingStock, 0);
|
||||
} else {
|
||||
// expand shell minimally triggering a clean
|
||||
shellRough = facePolys = POLY.expand(shellRough, 0.01, 0);
|
||||
}
|
||||
|
||||
if (anyFinish && pocketOnlyRough && !pocketOnlyFinish) {
|
||||
|
|
@ -1023,21 +1026,25 @@ var gs_kiri_cam = exports;
|
|||
sliceAll.forEach(function(slice, index) {
|
||||
// re-index
|
||||
slice.index = index;
|
||||
let modekey = "?mode?";
|
||||
switch (slice.camMode) {
|
||||
case CPRO.FACING:
|
||||
modekey = "facing";
|
||||
createFacingSlices(slice, facePolys, roughToolDiam, proc.roughingOver, pocketOnlyRough);
|
||||
break;
|
||||
case CPRO.ROUGH:
|
||||
modekey = "roughing";
|
||||
createRoughingSlices(slice, shellRough, roughToolDiam, proc.roughingStock * units, proc.roughingOver, pocketOnlyRough);
|
||||
if (addTabsRough) addCutoutTabs(slice, roughToolDiam);
|
||||
break;
|
||||
case CPRO.FINISH:
|
||||
modekey = "finishing";
|
||||
if (profile) findTracingPaths(widget, slice, tool, profile);
|
||||
createFinishingSlices(slice, shellFinish, finishToolDiam, pocketOnlyFinish);
|
||||
if (addTabsFinish) addCutoutTabs(slice, finishToolDiam);
|
||||
break;
|
||||
}
|
||||
onupdate(0.90 + (index / sliceAll.length) * 0.10, "finishing")
|
||||
onupdate(0.90 + (index / sliceAll.length) * 0.10, modekey);
|
||||
}, "cam post");
|
||||
|
||||
ondone();
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ let gs_kiri_slicer = exports;
|
|||
// emit a polygon if it can be cleaned and still have 2 or more points
|
||||
function emit(poly) {
|
||||
poly = poly.clean();
|
||||
if (poly.length > 2) output.push(poly.clean());
|
||||
if (poly.length > 2) output.push(poly);
|
||||
}
|
||||
|
||||
// given an array of paths, emit longest to shortest
|
||||
|
|
|
|||
|
|
@ -914,7 +914,7 @@ let ver = require('../js/license.js'),
|
|||
"add-three",
|
||||
"add-class",
|
||||
"geo",
|
||||
"geo-wasm",
|
||||
// "geo-wasm",
|
||||
"geo-debug",
|
||||
"geo-point",
|
||||
"geo-slope",
|
||||
|
|
|
|||
Loading…
Reference in a new issue