fix gcode import and add extruder compensation from selected device. fix tool select script output

This commit is contained in:
Stewart Allen 2020-04-10 20:38:16 -04:00
commit 5030dbd5f3
4 changed files with 24 additions and 9 deletions

View file

@ -901,7 +901,6 @@ let gs_kiri_fdm = exports;
// look for extruder change and recalc emit factor
if (out.tool !== undefined && out.tool !== tool) {
appendAllSub(extruder.extSelect);
tool = out.tool;
subst.nozzle = subst.tool = tool;
extruder = extruders[tool];
@ -912,6 +911,7 @@ let gs_kiri_fdm = exports;
extruder.extFilament,
path.layer === 0 ?
(process.firstSliceHeight || process.sliceHeight) : path.height);
appendAllSub(extruder.extSelect);
}
// if no point in output, it's a dwell command

View file

@ -132,12 +132,25 @@ let gs_kiri_print = exports;
X: offset ? offset.x || 0 : 0,
Y: offset ? offset.y || 0 : 0,
Z: offset ? offset.z || 0 : 0
},
xoff = {
X: 0,
Y: 0,
Z: 0
};
lines.forEach(function(line) {
line = line.split(";")[0].split(" ");
if (line.length < 2) return;
switch (line.shift()) {
let cmd = line.shift();
if (cmd.charAt(0) === 'T') {
let ext = scope.settings.device.extruders;
let pos = parseInt(cmd.charAt(1));
if (ext && ext[pos]) {
xoff.X = -ext[pos].extOffsetX;
xoff.Y = -ext[pos].extOffsetY;
}
}
switch (cmd) {
case 'G90':
// absolute positioning
abs = true;
@ -165,7 +178,11 @@ let gs_kiri_print = exports;
}
addOutput(
seq,
{x:pos.X + off.X, y:pos.Y + off.Y, z:pos.Z + off.Z},
{
x:pos.X + off.X + xoff.X,
y:pos.Y + off.Y + xoff.Y,
z:pos.Z + off.Z + xoff.Z
},
!move,
pos.F,
tool
@ -389,7 +406,6 @@ let gs_kiri_print = exports;
move.push(sp.projectOnSlope(ao2, 0.5));
}
} else {
if (out.emit) DBUG.log("first point is emit");
z = point.z;
}
last = point;

View file

@ -1088,10 +1088,10 @@ self.kiri.copyright = exports.COPYRIGHT;
}
// called after all new widgets are loaded to update group positions
function platformGroupDone() {
function platformGroupDone(skipLayout) {
grouping = false;
Widget.Groups.loadDone();
if (layoutOnAdd) platform.layout();
if (layoutOnAdd && !skipLayout) platform.layout();
}
function platformAdd(widget, shift, nolayout) {
@ -1488,7 +1488,7 @@ self.kiri.copyright = exports.COPYRIGHT;
if (isgcode) loadCode(e.target.result, 'gcode');
if (issvg) loadCode(e.target.result, 'svg');
if (isset) settingsImport(e.target.result, true);
if (--loaded === 0) platform.group_done();
if (--loaded === 0) platform.group_done(isgcode);
};
reader.readAsBinaryString(reader.file);
}

View file

@ -743,7 +743,6 @@ button[import="1"] {
display: flex;
justify-content: center;
align-items: center;
min-width: 25%;
max-width: 50%;
background-color: rgba(230,245,255,0.8);
border: 3px solid rgba(200,215,255,0.6);