belt anchor new peeks into the first 5 layers to find the max width to use. bump rev 2.7.D2

This commit is contained in:
Stewart Allen 2021-02-08 20:18:15 -05:00
commit 80693c2576
4 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"name": "grid-apps",
"version": "2.7.1D",
"version": "2.7.2D",
"description": "grid.space 3d slice & modeling tools",
"author": "Stewart Allen <sa@grid.space>",
"license": "MIT",

View file

@ -6,7 +6,7 @@
if (!self.kiri) {
self.kiri = {
beta: 2701,
beta: 2702,
driver: {}, // driver modules
loader: [] // module loading: array of functions
};

View file

@ -3,7 +3,7 @@
let terms = {
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE: "See the license.md file included with the source distribution",
VERSION: "2.7.D1"
VERSION: "2.7.D2"
};
if (typeof(module) === 'object') {

View file

@ -313,8 +313,16 @@
slice.belt = { miny, touch: false };
}
// mark slices with tops touching belt
// also find max width of first 5 layers
let start;
let minx = Infinity, maxx = -Infinity;
for (let slice of slices) {
if (slice.index < 5) {
for (let poly of slice.topPolys()) {
minx = Math.min(minx, poly.bounds.minx);
maxx = Math.max(maxx, poly.bounds.maxx);
}
}
if (Math.abs(slice.belt.miny - smin) < 0.001) {
slice.belt.touch = true;
if (!start) start = slice;
@ -339,7 +347,8 @@
addto.belt.anchor = true;
let z = addto.z;
let y = z - smin - (nozzleSize / 2);
let splat = BASE.newPolygon().add(wb.min.x, y, z).add(wb.max.x, y, z).setOpen();
// let splat = BASE.newPolygon().add(wb.min.x, y, z).add(wb.max.x, y, z).setOpen();
let splat = BASE.newPolygon().add(minx, y, z).add(maxx, y, z).setOpen();
addto.addTop(splat).fill_sparse = [ splat ];
start = addto;
offset -= sliceHeight;