add first tool/nozzle var. allow shared tool change macro
This commit is contained in:
parent
4243be41e2
commit
d413ca2590
2 changed files with 14 additions and 18 deletions
|
|
@ -14,7 +14,7 @@ const { getRangeParameters } = FDM;
|
||||||
const debug = false;
|
const debug = false;
|
||||||
|
|
||||||
FDM.export = function(print, online, ondone, ondebug) {
|
FDM.export = function(print, online, ondone, ondebug) {
|
||||||
const { settings, belty, tools } = print;
|
const { settings, belty, tools, firstTool } = print;
|
||||||
const { bounds, controller, device, process, filter, mode } = settings;
|
const { bounds, controller, device, process, filter, mode } = settings;
|
||||||
const { extruders, fwRetract } = device;
|
const { extruders, fwRetract } = device;
|
||||||
const { bedWidth, bedDepth, bedRound, bedBelt, maxHeight } = device;
|
const { bedWidth, bedDepth, bedRound, bedBelt, maxHeight } = device;
|
||||||
|
|
@ -72,7 +72,7 @@ FDM.export = function(print, online, ondone, ondebug) {
|
||||||
y: isBelt ? 0 : bedDepth/2,
|
y: isBelt ? 0 : bedDepth/2,
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
tool = 0,
|
tool = firstTool || 0,
|
||||||
extruder = extruders[tool],
|
extruder = extruders[tool],
|
||||||
offset_x = extruder.extOffsetX,
|
offset_x = extruder.extOffsetX,
|
||||||
offset_y = extruder.extOffsetY,
|
offset_y = extruder.extOffsetY,
|
||||||
|
|
@ -107,8 +107,8 @@ FDM.export = function(print, online, ondone, ondebug) {
|
||||||
z_max: maxHeight,
|
z_max: maxHeight,
|
||||||
layers: layers.length,
|
layers: layers.length,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
nozzle: 0,
|
nozzle: tool,
|
||||||
tool: 0
|
tool: tool
|
||||||
},
|
},
|
||||||
pidx, path, out, speedMMM, emitMM, emitPerMM, lastp, laste, dist,
|
pidx, path, out, speedMMM, emitMM, emitPerMM, lastp, laste, dist,
|
||||||
lines = 0,
|
lines = 0,
|
||||||
|
|
@ -353,16 +353,8 @@ FDM.export = function(print, online, ondone, ondebug) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (line.indexOf("{tool}") > 0 && extused.length > 0) {
|
|
||||||
for (let i of extused) {
|
|
||||||
subst.tool = i;
|
|
||||||
appendSubPad(line);
|
appendSubPad(line);
|
||||||
}
|
}
|
||||||
subst.tool = 0;
|
|
||||||
} else {
|
|
||||||
appendSubPad(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pre === 2) preamble();
|
if (pre === 2) preamble();
|
||||||
|
|
||||||
|
|
@ -608,8 +600,11 @@ FDM.export = function(print, online, ondone, ondebug) {
|
||||||
|
|
||||||
// look for extruder change, run scripts, recalc emit factor
|
// look for extruder change, run scripts, recalc emit factor
|
||||||
if (out.tool !== undefined && out.tool != tool) {
|
if (out.tool !== undefined && out.tool != tool) {
|
||||||
|
let macro_deselect = extruder.extDeselect.length ? extruder.extDeselect : extruders[0].extDeselect;
|
||||||
|
let macro_select = extruder.extSelect.length ? extruder.extSelect : extruders[0].extSelect;
|
||||||
segments.push({emitted, tool});
|
segments.push({emitted, tool});
|
||||||
appendAllSub(extruder.extDeselect);
|
appendAllSub(macro_deselect);
|
||||||
|
subst.last_tool = tool;
|
||||||
tool = out.tool;
|
tool = out.tool;
|
||||||
subst.nozzle = subst.tool = tool;
|
subst.nozzle = subst.tool = tool;
|
||||||
extruder = extruders[tool];
|
extruder = extruders[tool];
|
||||||
|
|
@ -620,7 +615,7 @@ FDM.export = function(print, online, ondone, ondebug) {
|
||||||
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);
|
appendAllSub(macro_select);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no point in output, it's a dwell command
|
// if no point in output, it's a dwell command
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,7 @@ FDM.prepare = async function(widgets, settings, update) {
|
||||||
return a.z - b.z;
|
return a.z - b.z;
|
||||||
});
|
});
|
||||||
|
|
||||||
let firstExt;
|
let firstTool;
|
||||||
let lastWidget;
|
let lastWidget;
|
||||||
let lastExt;
|
let lastExt;
|
||||||
let lastOut;
|
let lastOut;
|
||||||
|
|
@ -516,8 +516,8 @@ FDM.prepare = async function(widgets, settings, update) {
|
||||||
return a.dst - b.dst;
|
return a.dst - b.dst;
|
||||||
});
|
});
|
||||||
let { z, slice, offset } = order[0];
|
let { z, slice, offset } = order[0];
|
||||||
if (firstExt === undefined) {
|
if (firstTool === undefined) {
|
||||||
firstExt = slice.extruder;
|
firstTool = slice.extruder;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when layers switch between widgets, force retraction
|
// when layers switch between widgets, force retraction
|
||||||
|
|
@ -644,6 +644,7 @@ FDM.prepare = async function(widgets, settings, update) {
|
||||||
}
|
}
|
||||||
|
|
||||||
print.output = output;
|
print.output = output;
|
||||||
|
print.firstTool = firstTool;
|
||||||
|
|
||||||
// post-process for base extrusions (touching the bed)
|
// post-process for base extrusions (touching the bed)
|
||||||
if (isBelt) {
|
if (isBelt) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue