create proper Output class. clone brim to current z when output

This commit is contained in:
Stewart Allen 2022-02-05 14:50:33 -05:00
commit 1e1f47868d
2 changed files with 25 additions and 10 deletions

View file

@ -570,7 +570,9 @@
// draft shield // draft shield
if (layerno > 0 && brimout && draftShield) { if (layerno > 0 && brimout && draftShield) {
print.setType('brim'); print.setType('brim');
print.addPrintPoints(brimout, layerout, null); print.addPrintPoints(brimout.map(o => o.clone(printPoint.z)), layerout, null);
layerout.last().retract = true;
printPoint = layerout.last().point;
} }
// if a declared extruder isn't used in a layer, use selected // if a declared extruder isn't used in a layer, use selected

View file

@ -413,10 +413,8 @@
return a !== undefined ? a : b; return a !== undefined ? a : b;
} }
/** class Output {
* @constructor constructor(point, emit, speed, tool, type) {
*/
function Output(point, emit, speed, tool, type) {
this.point = point; // point to emit this.point = point; // point to emit
this.emit = emit; // emit (feed for printers, power for lasers, cut for cam) this.emit = emit; // emit (feed for printers, power for lasers, cut for cam)
this.speed = speed; this.speed = speed;
@ -424,6 +422,21 @@
this.type = type; this.type = type;
} }
clone(z) {
let o = new Output(
this.point.clone(),
this.emit,
this.speed,
this.tool,
this.type
);
if (z !== undefined) {
o.point.setZ(z);
}
return o;
}
}
function setType(type) { function setType(type) {
nextType = type; nextType = type;
} }