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 stockCenter = stock.center || {};
|
||||
let hasStock = stock.x && stock.y && stock.z;
|
||||
let isBelt = dev.bedBelt;
|
||||
let center = MODE === MODES.FDM ? dev.originCenter :
|
||||
MODE === MODES.SLA ? false :
|
||||
MODE === MODES.CAM ? proc.outputOriginCenter :
|
||||
|
|
@ -1279,7 +1280,7 @@
|
|||
y = -b.min.y
|
||||
} else {
|
||||
x = -dev.bedWidth / 2;
|
||||
y = dev.bedDepth / 2;
|
||||
y = isBelt ? 0 : dev.bedDepth / 2;
|
||||
}
|
||||
}
|
||||
} else if (hasStock) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@
|
|||
.split("\n");
|
||||
|
||||
const scope = this,
|
||||
morph = false,
|
||||
bounds = scope.bounds = {
|
||||
max: { x:-Infinity, y:-Infinity, z:-Infinity},
|
||||
min: { x:Infinity, y:Infinity, z:Infinity}
|
||||
|
|
@ -142,7 +143,7 @@
|
|||
|
||||
line.forEach(function(tok) {
|
||||
let axis = tok.charAt(0);
|
||||
if (belt) {
|
||||
if (morph && belt) {
|
||||
axis = beltaxis[axis];
|
||||
}
|
||||
if (abs) {
|
||||
|
|
@ -164,21 +165,21 @@
|
|||
factor * pos.Z + off.Z + xoff.Z + dz
|
||||
);
|
||||
|
||||
if (belt) {
|
||||
if (morph && belt) {
|
||||
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 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
|
||||
maxf = Math.max(maxf, pos.F);
|
||||
|
||||
|
|
@ -287,12 +288,12 @@
|
|||
});
|
||||
|
||||
// recenter for visualization
|
||||
if (belt) {
|
||||
if (morph && belt) {
|
||||
for (let layer of output) {
|
||||
for (let rec of layer) {
|
||||
let point = rec.point;
|
||||
point.y += bounds.min.z;
|
||||
point.z -= bounds.min.z;
|
||||
point.y -= bounds.min.z;
|
||||
point.z += bounds.min.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
timeDwell = retDwell / 1000,
|
||||
offset = process.outputOriginCenter ? null : {
|
||||
x: device.bedWidth/2,
|
||||
y: device.bedDepth/2
|
||||
y: isBelt ? 0 : device.bedDepth/2
|
||||
},
|
||||
subst = {
|
||||
travel_speed: seekMMM,
|
||||
|
|
@ -182,7 +182,9 @@
|
|||
append(";; " + comment);
|
||||
}
|
||||
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') {
|
||||
pos.x = newpos.x;
|
||||
emit.x = true;
|
||||
|
|
@ -289,7 +291,9 @@
|
|||
|
||||
// move Z to layer height
|
||||
zpos += path.height;
|
||||
moveTo({z:zpos}, seekMMM);
|
||||
if (layer > 0 || !isBelt) {
|
||||
moveTo({z:zpos}, seekMMM);
|
||||
}
|
||||
|
||||
// iterate through layer outputs
|
||||
for (pidx=0; pidx<path.length; pidx++) {
|
||||
|
|
@ -321,7 +325,7 @@
|
|||
y = out.point.y + offset_y,
|
||||
z = out.point.z;
|
||||
|
||||
// adjust for inversions and offsets
|
||||
// adjust for inversions and origin offsets
|
||||
if (process.outputInvertX) x = -x;
|
||||
if (process.outputInvertY) y = -y;
|
||||
if (offset) {
|
||||
|
|
|
|||
|
|
@ -398,6 +398,24 @@
|
|||
|
||||
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
|
||||
if (render) {
|
||||
print.render = FDM.prepareRender(output, (progress, layer) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue