checkpoint belt work
This commit is contained in:
parent
a44b347207
commit
d0cef6eedc
6 changed files with 44 additions and 59 deletions
|
|
@ -938,11 +938,11 @@
|
|||
setOpacity(color.preview_opacity);
|
||||
}
|
||||
|
||||
let segtimes = {},
|
||||
let now = Date.now(),
|
||||
segNumber = 0,
|
||||
segtimes = {},
|
||||
startTime,
|
||||
lastMsg,
|
||||
now = Date.now(),
|
||||
output = [];
|
||||
|
||||
KIRI.client.prepare(settings, function(progress, message, layer) {
|
||||
|
|
@ -966,7 +966,6 @@
|
|||
API.show.progress(0);
|
||||
if (!isCam) setOpacity(0);
|
||||
|
||||
// output = KIRI.codec.decode(output);
|
||||
if (feature.preview && output.length) {
|
||||
startTime = Date.now();
|
||||
STACKS.clear();
|
||||
|
|
@ -977,10 +976,9 @@
|
|||
// rotate stack for belt beds
|
||||
if (settings.device.bedBelt && WIDGETS[0].rotinfo) {
|
||||
let ri = WIDGETS[0].rotinfo;
|
||||
// console.log(ri)
|
||||
// ri.dy = ri.dz = 0;
|
||||
// ri.dy = settings.device.bedDepth / 2 - ri.ypos;
|
||||
// stack.obj.rotate(WIDGETS[0].rotinfo);
|
||||
ri.dz = 0;
|
||||
ri.dy = settings.device.bedDepth / 2;
|
||||
stack.obj.rotate(WIDGETS[0].rotinfo);
|
||||
}
|
||||
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
|
||||
}
|
||||
|
|
@ -1688,7 +1686,7 @@
|
|||
if (isBelt) {
|
||||
let bounds = platformUpdateBounds(),
|
||||
movey = -(dev.bedDepth / 2 + bounds.min.y);
|
||||
forAllWidgets(widget => widget.move(0, movey + 0, 0));
|
||||
forAllWidgets(widget => widget.move(0, movey + 10, 0));
|
||||
}
|
||||
|
||||
platform.update_origin();
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@
|
|||
return scope.output;
|
||||
};
|
||||
|
||||
PRO.parseGCode = function(gcode, offset, progress, done, options) {
|
||||
const opts = options || {};
|
||||
PRO.parseGCode = function(gcode, offset, progress, done, opts = {}) {
|
||||
const fdm = opts.fdm;
|
||||
const belt = opts.belt;
|
||||
const lines = gcode
|
||||
.toUpperCase()
|
||||
.replace("X", " X")
|
||||
|
|
@ -126,13 +126,13 @@
|
|||
let dz = 0,
|
||||
abs = true,
|
||||
absE = true,
|
||||
belt = false,
|
||||
defh = 0,
|
||||
height = 0,
|
||||
factor = 1,
|
||||
tool = 0,
|
||||
maxf = 0,
|
||||
seq = [],
|
||||
autolayer = true,
|
||||
newlayer = false;
|
||||
|
||||
const output = scope.output = [ seq ];
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
|
||||
// non-move in a new plane means burp out
|
||||
// the old sequence and start a new one
|
||||
if (newlayer || (!belt && seq.Z != pos.Z)) {
|
||||
if (newlayer || (autolayer && seq.Z != pos.Z)) {
|
||||
newlayer = false;
|
||||
let nh = (defh || pos.Z - seq.Z);
|
||||
seq = [];
|
||||
|
|
@ -228,10 +228,9 @@
|
|||
}
|
||||
|
||||
lines.forEach(function(line, idx) {
|
||||
if (idx < 10) console.log({line})
|
||||
if (line.indexOf(';LAYER:') === 0) {
|
||||
newlayer = true;
|
||||
if (idx < 100) console.log({newlayer});
|
||||
autolayer = false;
|
||||
}
|
||||
if (line.indexOf('- LAYER ') > 0) {
|
||||
seq.height = defh;
|
||||
|
|
@ -239,11 +238,7 @@ if (idx < 100) console.log({newlayer});
|
|||
defh = parseFloat(hd[4]);
|
||||
if (fdm) dz = -defh / 2;
|
||||
newlayer = true;
|
||||
if (idx < 100) console.log({layer: defh});
|
||||
}
|
||||
if (line.indexOf("BED TYPE: BELT") > 0) {
|
||||
belt = true;
|
||||
if (idx < 100) console.log({isbelt: belt});
|
||||
autolayer = false;
|
||||
}
|
||||
line = line.split(";")[0].split(" ").filter(v => v);
|
||||
let cmd = line.shift();
|
||||
|
|
|
|||
|
|
@ -212,8 +212,9 @@ KIRI.worker = {
|
|||
y: -origin.y,
|
||||
z: origin.z
|
||||
};
|
||||
const device = settings.device;
|
||||
const print = current.print = KIRI.newPrint(settings, Object.values(cache));
|
||||
const tools = settings.device.extruders;
|
||||
const tools = device.extruders;
|
||||
const mode = settings.mode;
|
||||
const thin = settings.controller.lineType === 'line' || mode !== 'FDM';
|
||||
const flat = settings.controller.lineType === 'flat' && mode === 'FDM';
|
||||
|
|
@ -225,7 +226,10 @@ KIRI.worker = {
|
|||
send.data({ progress: 0.25 + progress * 0.75 });
|
||||
}, { thin: thin || print.belt, flat, tools });
|
||||
send.done({parsed: KIRI.codec.encode(layers), maxSpeed});
|
||||
}, { fdm : mode === 'FDM' });
|
||||
}, {
|
||||
fdm: mode === 'FDM',
|
||||
belt: device.bedBelt
|
||||
});
|
||||
},
|
||||
|
||||
parse_svg: function(parsed, send) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
bytes = 0,
|
||||
bcos = Math.cos(Math.PI/4),
|
||||
icos = 1 / bcos;
|
||||
console.log({isBelt, offset});
|
||||
|
||||
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
||||
let v = parseInt(lv);
|
||||
if (v >= 0) pause.push(v);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@
|
|||
isFlat = settings.controller.lineType === "flat",
|
||||
isBelt = device.bedBelt,
|
||||
beltYoff = device.bedDepth / 2,
|
||||
bcos = Math.cos(Math.PI/4),
|
||||
icos = 1 / bcos;
|
||||
beltfact = Math.cos(Math.PI/4);
|
||||
|
||||
// compute bounds if missing
|
||||
if (!bounds) {
|
||||
|
|
@ -196,47 +195,42 @@
|
|||
bounds.max.y = Math.max(bounds.max.y, bbounds.maxy);
|
||||
}
|
||||
|
||||
// synthesize a support widget, if needed
|
||||
if (!isBelt) {
|
||||
let swidget = KIRI.newWidget();
|
||||
let sslices = swidget.slices = [];
|
||||
widgets.forEach(function(widget) {
|
||||
let slices = widget.slices;
|
||||
while (sslices.length < slices.length) {
|
||||
let sslice = KIRI.newSlice(slices[sslices.length].z);
|
||||
// synthesize support widgets when needed
|
||||
// so that they can use a separate extruder
|
||||
for (let widget of widgets.slice()) {
|
||||
let sslices = [];
|
||||
for (let slice of widget.slices) {
|
||||
if (!slice.supports) {
|
||||
continue;
|
||||
}
|
||||
let sslice = KIRI.newSlice(slice.z);
|
||||
sslice.extruder = process.sliceSupportNozzle;
|
||||
sslice.supports = slice.supports.slice();
|
||||
sslices.push(sslice);
|
||||
}
|
||||
slices.forEach((slice,index) => {
|
||||
if (!slice.supports) return;
|
||||
if (!sslices[index].supports) {
|
||||
sslices[index].supports = [];
|
||||
}
|
||||
sslices[index].supports.appendAll(slice.supports.map(p => {
|
||||
if (p.fill) p.fill.forEach(p => p.move(widget.track.pos));
|
||||
return p.move(widget.track.pos);
|
||||
}));
|
||||
});
|
||||
});
|
||||
if (sslices.length) {
|
||||
let swidget = KIRI.newWidget();
|
||||
swidget.slices = sslices;
|
||||
swidget.support = true;
|
||||
swidget.mesh = { widget: swidget }; // fake for lookup
|
||||
swidget.mesh = { widget: swidget, position: widget.mesh.position };
|
||||
settings.widget[swidget.id] = { extruder: process.sliceSupportNozzle };
|
||||
widgets.push(swidget);
|
||||
}
|
||||
}
|
||||
|
||||
let extruders = [];
|
||||
let extcount = 0;
|
||||
|
||||
// find max layers (for updates)
|
||||
// generate list of used extruders for purge blocks
|
||||
widgets.forEach(function(widget) {
|
||||
for (let widget of widgets) {
|
||||
maxLayers = Math.max(maxLayers, widget.slices.length);
|
||||
let extruder = (settings.widget[widget.id] || {}).extruder || 0;
|
||||
if (!extruders[extruder]) {
|
||||
extruders[extruder] = {};
|
||||
extcount++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let blokpos, walkpos, blok;
|
||||
if (bounds.min.x < bounds.min.y) {
|
||||
|
|
@ -293,8 +287,8 @@
|
|||
if (isBelt) {
|
||||
offset.x = widget.rotinfo.xpos;
|
||||
offset.y = widget.belt.miny;
|
||||
offset.y += widget.rotinfo.ypos * bcos;
|
||||
offset.z = widget.rotinfo.ypos * bcos;
|
||||
offset.y += widget.rotinfo.ypos * beltfact;
|
||||
offset.z = widget.rotinfo.ypos * beltfact;
|
||||
} else {
|
||||
// when rafts used this is non-zero
|
||||
offset.z = zoff;
|
||||
|
|
|
|||
|
|
@ -274,12 +274,6 @@
|
|||
bounds.merge(top.poly.bounds);
|
||||
}
|
||||
widget.belt.miny = -bounds.miny;
|
||||
// widget.belt.yy2 = sdev.bedDepth / 2 + widget.track.pos.y;
|
||||
// widget.belt = {
|
||||
// offset_y: bounds.miny,
|
||||
// pos_y: sdev.bedDepth / 2 + widget.track.pos.y,
|
||||
// ypos: widget.belt.ypos
|
||||
// };
|
||||
}
|
||||
|
||||
// report slicing complete
|
||||
|
|
|
|||
Loading…
Reference in a new issue