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 // look for extruder change and recalc emit factor
if (out.tool !== undefined && out.tool !== tool) { if (out.tool !== undefined && out.tool !== tool) {
appendAllSub(extruder.extSelect);
tool = out.tool; tool = out.tool;
subst.nozzle = subst.tool = tool; subst.nozzle = subst.tool = tool;
extruder = extruders[tool]; extruder = extruders[tool];
@ -912,6 +911,7 @@ let gs_kiri_fdm = exports;
extruder.extFilament, extruder.extFilament,
path.layer === 0 ? path.layer === 0 ?
(process.firstSliceHeight || process.sliceHeight) : path.height); (process.firstSliceHeight || process.sliceHeight) : path.height);
appendAllSub(extruder.extSelect);
} }
// if no point in output, it's a dwell command // 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, X: offset ? offset.x || 0 : 0,
Y: offset ? offset.y || 0 : 0, Y: offset ? offset.y || 0 : 0,
Z: offset ? offset.z || 0 : 0 Z: offset ? offset.z || 0 : 0
},
xoff = {
X: 0,
Y: 0,
Z: 0
}; };
lines.forEach(function(line) { lines.forEach(function(line) {
line = line.split(";")[0].split(" "); line = line.split(";")[0].split(" ");
if (line.length < 2) return; let cmd = line.shift();
switch (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': case 'G90':
// absolute positioning // absolute positioning
abs = true; abs = true;
@ -165,7 +178,11 @@ let gs_kiri_print = exports;
} }
addOutput( addOutput(
seq, 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, !move,
pos.F, pos.F,
tool tool
@ -389,7 +406,6 @@ let gs_kiri_print = exports;
move.push(sp.projectOnSlope(ao2, 0.5)); move.push(sp.projectOnSlope(ao2, 0.5));
} }
} else { } else {
if (out.emit) DBUG.log("first point is emit");
z = point.z; z = point.z;
} }
last = point; last = point;

View file

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

View file

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