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