more belt tweaks
This commit is contained in:
parent
848b168bc8
commit
9a94a87aef
4 changed files with 41 additions and 17 deletions
|
|
@ -1258,6 +1258,7 @@
|
||||||
let stock = settings.stock;
|
let stock = settings.stock;
|
||||||
let stockCenter = stock.center || {};
|
let stockCenter = stock.center || {};
|
||||||
let hasStock = stock.x && stock.y && stock.z;
|
let hasStock = stock.x && stock.y && stock.z;
|
||||||
|
let isBelt = dev.bedBelt;
|
||||||
let center = MODE === MODES.FDM ? dev.originCenter :
|
let center = MODE === MODES.FDM ? dev.originCenter :
|
||||||
MODE === MODES.SLA ? false :
|
MODE === MODES.SLA ? false :
|
||||||
MODE === MODES.CAM ? proc.outputOriginCenter :
|
MODE === MODES.CAM ? proc.outputOriginCenter :
|
||||||
|
|
@ -1279,7 +1280,7 @@
|
||||||
y = -b.min.y
|
y = -b.min.y
|
||||||
} else {
|
} else {
|
||||||
x = -dev.bedWidth / 2;
|
x = -dev.bedWidth / 2;
|
||||||
y = dev.bedDepth / 2;
|
y = isBelt ? 0 : dev.bedDepth / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (hasStock) {
|
} else if (hasStock) {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@
|
||||||
.split("\n");
|
.split("\n");
|
||||||
|
|
||||||
const scope = this,
|
const scope = this,
|
||||||
|
morph = false,
|
||||||
bounds = scope.bounds = {
|
bounds = scope.bounds = {
|
||||||
max: { x:-Infinity, y:-Infinity, z:-Infinity},
|
max: { x:-Infinity, y:-Infinity, z:-Infinity},
|
||||||
min: { x:Infinity, y:Infinity, z:Infinity}
|
min: { x:Infinity, y:Infinity, z:Infinity}
|
||||||
|
|
@ -142,7 +143,7 @@
|
||||||
|
|
||||||
line.forEach(function(tok) {
|
line.forEach(function(tok) {
|
||||||
let axis = tok.charAt(0);
|
let axis = tok.charAt(0);
|
||||||
if (belt) {
|
if (morph && belt) {
|
||||||
axis = beltaxis[axis];
|
axis = beltaxis[axis];
|
||||||
}
|
}
|
||||||
if (abs) {
|
if (abs) {
|
||||||
|
|
@ -164,21 +165,21 @@
|
||||||
factor * pos.Z + off.Z + xoff.Z + dz
|
factor * pos.Z + off.Z + xoff.Z + dz
|
||||||
);
|
);
|
||||||
|
|
||||||
if (belt) {
|
if (morph && belt) {
|
||||||
point.z *= beltfact;
|
point.z *= beltfact;
|
||||||
point.y -= point.z * beltfact;
|
point.y -= point.z * beltfact;
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds.min.x = Math.min(bounds.min.x, point.x);
|
|
||||||
bounds.max.x = Math.max(bounds.max.x, point.x);
|
|
||||||
bounds.min.y = Math.min(bounds.min.y, point.y);
|
|
||||||
bounds.max.y = Math.max(bounds.max.y, point.y);
|
|
||||||
bounds.min.z = Math.min(bounds.min.z, point.z);
|
|
||||||
bounds.max.z = Math.max(bounds.max.z, point.z);
|
|
||||||
|
|
||||||
const retract = (fdm && pos.E < 0) || undefined;
|
const retract = (fdm && pos.E < 0) || undefined;
|
||||||
const moving = g0 || (fdm && pos.E <= 0);
|
const moving = g0 || (fdm && pos.E <= 0);
|
||||||
|
|
||||||
|
if (!moving && point.x) bounds.min.x = Math.min(bounds.min.x, point.x);
|
||||||
|
if (!moving && point.x) bounds.max.x = Math.max(bounds.max.x, point.x);
|
||||||
|
if (!moving && point.y) bounds.min.y = Math.min(bounds.min.y, point.y);
|
||||||
|
if (!moving && point.y) bounds.max.y = Math.max(bounds.max.y, point.y);
|
||||||
|
if (!moving && point.z) bounds.min.z = Math.min(bounds.min.z, point.z);
|
||||||
|
if (!moving && point.z) bounds.max.z = Math.max(bounds.max.z, point.z);
|
||||||
|
|
||||||
// update max speed
|
// update max speed
|
||||||
maxf = Math.max(maxf, pos.F);
|
maxf = Math.max(maxf, pos.F);
|
||||||
|
|
||||||
|
|
@ -287,12 +288,12 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// recenter for visualization
|
// recenter for visualization
|
||||||
if (belt) {
|
if (morph && belt) {
|
||||||
for (let layer of output) {
|
for (let layer of output) {
|
||||||
for (let rec of layer) {
|
for (let rec of layer) {
|
||||||
let point = rec.point;
|
let point = rec.point;
|
||||||
point.y += bounds.min.z;
|
point.y -= bounds.min.z;
|
||||||
point.z -= bounds.min.z;
|
point.z += bounds.min.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
timeDwell = retDwell / 1000,
|
timeDwell = retDwell / 1000,
|
||||||
offset = process.outputOriginCenter ? null : {
|
offset = process.outputOriginCenter ? null : {
|
||||||
x: device.bedWidth/2,
|
x: device.bedWidth/2,
|
||||||
y: device.bedDepth/2
|
y: isBelt ? 0 : device.bedDepth/2
|
||||||
},
|
},
|
||||||
subst = {
|
subst = {
|
||||||
travel_speed: seekMMM,
|
travel_speed: seekMMM,
|
||||||
|
|
@ -182,7 +182,9 @@
|
||||||
append(";; " + comment);
|
append(";; " + comment);
|
||||||
}
|
}
|
||||||
let o = [!rate && !newpos.e ? 'G0' : 'G1'];
|
let o = [!rate && !newpos.e ? 'G0' : 'G1'];
|
||||||
let emit = { x: isBelt, y: isBelt, z: isBelt };
|
// put out x,y,z in belt mode if not engage/retract
|
||||||
|
let xyz = newpos.x || newpos.y || newpos.z;
|
||||||
|
let emit = { x: xyz && isBelt, y: xyz && isBelt, z: xyz && isBelt };
|
||||||
if (typeof newpos.x === 'number') {
|
if (typeof newpos.x === 'number') {
|
||||||
pos.x = newpos.x;
|
pos.x = newpos.x;
|
||||||
emit.x = true;
|
emit.x = true;
|
||||||
|
|
@ -289,7 +291,9 @@
|
||||||
|
|
||||||
// move Z to layer height
|
// move Z to layer height
|
||||||
zpos += path.height;
|
zpos += path.height;
|
||||||
|
if (layer > 0 || !isBelt) {
|
||||||
moveTo({z:zpos}, seekMMM);
|
moveTo({z:zpos}, seekMMM);
|
||||||
|
}
|
||||||
|
|
||||||
// iterate through layer outputs
|
// iterate through layer outputs
|
||||||
for (pidx=0; pidx<path.length; pidx++) {
|
for (pidx=0; pidx<path.length; pidx++) {
|
||||||
|
|
@ -321,7 +325,7 @@
|
||||||
y = out.point.y + offset_y,
|
y = out.point.y + offset_y,
|
||||||
z = out.point.z;
|
z = out.point.z;
|
||||||
|
|
||||||
// adjust for inversions and offsets
|
// adjust for inversions and origin offsets
|
||||||
if (process.outputInvertX) x = -x;
|
if (process.outputInvertX) x = -x;
|
||||||
if (process.outputInvertY) y = -y;
|
if (process.outputInvertY) y = -y;
|
||||||
if (offset) {
|
if (offset) {
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,24 @@
|
||||||
|
|
||||||
print.output = output;
|
print.output = output;
|
||||||
|
|
||||||
|
// if belt, adjust z and y to baselines
|
||||||
|
if (false && isBelt) {
|
||||||
|
let miny = Infinity, minz = Infinity;
|
||||||
|
for (let layer of output) {
|
||||||
|
for (let rec of layer) {
|
||||||
|
miny = Math.min(miny, rec.point.y);
|
||||||
|
minz = Math.min(minz, rec.point.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log({miny, minz});
|
||||||
|
for (let layer of output) {
|
||||||
|
for (let rec of layer) {
|
||||||
|
// rec.point.y -= minz;
|
||||||
|
// rec.point.z -= miny;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// render if not explicitly disabled
|
// render if not explicitly disabled
|
||||||
if (render) {
|
if (render) {
|
||||||
print.render = FDM.prepareRender(output, (progress, layer) => {
|
print.render = FDM.prepareRender(output, (progress, layer) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue