allow for reasonable parsing / visualization of large cam gcode files
This commit is contained in:
parent
e973792ef6
commit
017a85f25c
2 changed files with 8 additions and 0 deletions
|
|
@ -548,6 +548,7 @@ kiri.worker = {
|
||||||
});
|
});
|
||||||
}, {
|
}, {
|
||||||
fdm: mode === 'FDM',
|
fdm: mode === 'FDM',
|
||||||
|
cam: mode === 'CAM',
|
||||||
belt: device.bedBelt
|
belt: device.bedBelt
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ class Print {
|
||||||
|
|
||||||
parseGCode(gcode, offset, progress, done, opts = {}) {
|
parseGCode(gcode, offset, progress, done, opts = {}) {
|
||||||
const fdm = opts.fdm;
|
const fdm = opts.fdm;
|
||||||
|
const cam = opts.cam;
|
||||||
const belt = opts.belt;
|
const belt = opts.belt;
|
||||||
const lines = gcode
|
const lines = gcode
|
||||||
.toUpperCase()
|
.toUpperCase()
|
||||||
|
|
@ -468,7 +469,13 @@ class Print {
|
||||||
scope.lastPosE = pos.E;
|
scope.lastPosE = pos.E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const linemod = cam ? Math.ceil(lines.length / 2500) : 0;
|
||||||
|
|
||||||
lines.forEach((line, idx) => {
|
lines.forEach((line, idx) => {
|
||||||
|
if (linemod && idx % linemod === 0) {
|
||||||
|
newlayer = true;
|
||||||
|
autolayer = false;
|
||||||
|
}
|
||||||
if (line.indexOf(';LAYER:') === 0) {
|
if (line.indexOf(';LAYER:') === 0) {
|
||||||
newlayer = true;
|
newlayer = true;
|
||||||
autolayer = false;
|
autolayer = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue