restore basic gcode export for FDM
This commit is contained in:
parent
689a2ed3a3
commit
19d23fdf44
5 changed files with 105 additions and 57 deletions
|
|
@ -684,6 +684,9 @@ let gs_kiri_conf = exports;
|
||||||
alignTop: true,
|
alignTop: true,
|
||||||
units: "mm"
|
units: "mm"
|
||||||
},
|
},
|
||||||
|
// widget extra info for slicing (like extruder mapping)
|
||||||
|
widget: {
|
||||||
|
},
|
||||||
mode: 'FDM',
|
mode: 'FDM',
|
||||||
id: genID(),
|
id: genID(),
|
||||||
ver: CVER
|
ver: CVER
|
||||||
|
|
|
||||||
|
|
@ -50,26 +50,35 @@ var gs_kiri_fdm = exports;
|
||||||
solidLayers = spro.sliceSolidLayers,
|
solidLayers = spro.sliceSolidLayers,
|
||||||
vaseMode = spro.sliceFillType === 'vase',
|
vaseMode = spro.sliceFillType === 'vase',
|
||||||
doSolidLayers = solidLayers && !vaseMode,
|
doSolidLayers = solidLayers && !vaseMode,
|
||||||
firstOffset = sdev.nozzleSize / 2,
|
metadata = settings.widget[widget.id] || {},
|
||||||
shellOffset = sdev.nozzleSize,
|
extruder = metadata.extruder || 0,
|
||||||
fillOffset = sdev.nozzleSize * settings.synth.fillOffsetMult,
|
sliceHeight = spro.sliceHeight,
|
||||||
fillSpacing = sdev.nozzleSize,
|
nozzleSize = sdev.extruders[extruder].extNozzle,
|
||||||
|
firstOffset = nozzleSize / 2,
|
||||||
|
shellOffset = nozzleSize,
|
||||||
|
fillSpacing = nozzleSize,
|
||||||
|
fillOffset = nozzleSize * settings.synth.fillOffsetMult,
|
||||||
sliceFillAngle = spro.sliceFillAngle,
|
sliceFillAngle = spro.sliceFillAngle,
|
||||||
view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null;
|
view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null;
|
||||||
|
|
||||||
if (spro.sliceHeight < 0.01) {
|
// console.log({slice:widget.id, metadata, extruder, nozzleSize});
|
||||||
|
|
||||||
|
if (!(sliceHeight > 0 && sliceHeight < 100)) {
|
||||||
return ondone("invalid slice height");
|
return ondone("invalid slice height");
|
||||||
}
|
}
|
||||||
|
if (!(nozzleSize >= 0.01 && nozzleSize < 100)) {
|
||||||
|
return ondone("invalid nozzle size");
|
||||||
|
}
|
||||||
|
|
||||||
if (spro.firstSliceHeight < spro.sliceHeight) {
|
if (spro.firstSliceHeight < sliceHeight) {
|
||||||
DBUG.log("invalid first layer height < slice height");
|
DBUG.log("invalid first layer height < slice height");
|
||||||
DBUG.log("reverting to slice height");
|
DBUG.log("reverting to slice height");
|
||||||
spro.firstSliceHeight = spro.sliceHeight;
|
spro.firstSliceHeight = sliceHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
SLICER.sliceWidget(widget, {
|
SLICER.sliceWidget(widget, {
|
||||||
height: spro.sliceHeight,
|
height: sliceHeight,
|
||||||
minHeight: spro.sliceHeight > spro.sliceMinHeight ? spro.sliceMinHeight : 0,
|
minHeight: sliceHeight > spro.sliceMinHeight ? spro.sliceMinHeight : 0,
|
||||||
firstHeight: spro.firstSliceHeight,
|
firstHeight: spro.firstSliceHeight,
|
||||||
view: view
|
view: view
|
||||||
}, onSliceDone, onSliceUpdate);
|
}, onSliceDone, onSliceUpdate);
|
||||||
|
|
@ -101,6 +110,7 @@ var gs_kiri_fdm = exports;
|
||||||
|
|
||||||
// reset (if necessary) for solids and support projections
|
// reset (if necessary) for solids and support projections
|
||||||
slices.forEach(function(slice) {
|
slices.forEach(function(slice) {
|
||||||
|
slice.extruder = extruder;
|
||||||
slice.invalidateFill();
|
slice.invalidateFill();
|
||||||
slice.invalidateSolids();
|
slice.invalidateSolids();
|
||||||
slice.invalidateSupports();
|
slice.invalidateSupports();
|
||||||
|
|
@ -146,7 +156,7 @@ var gs_kiri_fdm = exports;
|
||||||
slice.doSupport(spro.sliceSupportOffset, spro.sliceSupportSpan, spro.sliceSupportExtra, supportMinArea, spro.sliceSupportSize, spro.sliceSupportOffset, spro.sliceSupportGap);
|
slice.doSupport(spro.sliceSupportOffset, spro.sliceSupportSpan, spro.sliceSupportExtra, supportMinArea, spro.sliceSupportSize, spro.sliceSupportOffset, spro.sliceSupportGap);
|
||||||
}, "support");
|
}, "support");
|
||||||
forSlices(0.7, 0.8, function(slice) {
|
forSlices(0.7, 0.8, function(slice) {
|
||||||
slice.doSupportFill(sdev.nozzleSize, spro.sliceSupportDensity, supportMinArea);
|
slice.doSupportFill(nozzleSize, spro.sliceSupportDensity, supportMinArea);
|
||||||
}, "support");
|
}, "support");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,11 +164,11 @@ var gs_kiri_fdm = exports;
|
||||||
if (!vaseMode && spro.sliceFillSparse > 0.0) {
|
if (!vaseMode && spro.sliceFillSparse > 0.0) {
|
||||||
forSlices(0.8, 1.0, function(slice) {
|
forSlices(0.8, 1.0, function(slice) {
|
||||||
slice.doSparseLayerFill({
|
slice.doSparseLayerFill({
|
||||||
lineWidth: sdev.nozzleSize,
|
lineWidth: nozzleSize,
|
||||||
spacing: fillOffset,
|
spacing: fillOffset,
|
||||||
density: spro.sliceFillSparse,
|
density: spro.sliceFillSparse,
|
||||||
bounds: widget.getBoundingBox(),
|
bounds: widget.getBoundingBox(),
|
||||||
height: spro.sliceHeight,
|
height: sliceHeight,
|
||||||
type: spro.sliceFillType
|
type: spro.sliceFillType
|
||||||
});
|
});
|
||||||
}, "infill");
|
}, "infill");
|
||||||
|
|
@ -174,7 +184,7 @@ var gs_kiri_fdm = exports;
|
||||||
let py = [];
|
let py = [];
|
||||||
// compute x polishing slices
|
// compute x polishing slices
|
||||||
SLICER.sliceWidget(widget, {
|
SLICER.sliceWidget(widget, {
|
||||||
height: sdev.nozzleSize * polish_step,
|
height: nozzleSize * polish_step,
|
||||||
swapX: true,
|
swapX: true,
|
||||||
swapY: false,
|
swapY: false,
|
||||||
simple: true
|
simple: true
|
||||||
|
|
@ -188,7 +198,7 @@ var gs_kiri_fdm = exports;
|
||||||
});
|
});
|
||||||
// compute y polishing slices
|
// compute y polishing slices
|
||||||
SLICER.sliceWidget(widget, {
|
SLICER.sliceWidget(widget, {
|
||||||
height: sdev.nozzleSize * polish_step,
|
height: nozzleSize * polish_step,
|
||||||
swapX: false,
|
swapX: false,
|
||||||
swapY: true,
|
swapY: true,
|
||||||
simple: true
|
simple: true
|
||||||
|
|
@ -338,11 +348,11 @@ var gs_kiri_fdm = exports;
|
||||||
slice.tops[0].polish = {
|
slice.tops[0].polish = {
|
||||||
x: pout[0]
|
x: pout[0]
|
||||||
.map(a => BASE.newPolygon(a).setOpen())
|
.map(a => BASE.newPolygon(a).setOpen())
|
||||||
// .filter(p => p.perimeter() > sdev.nozzleSize)
|
// .filter(p => p.perimeter() > nozzleSize)
|
||||||
,
|
,
|
||||||
y: pout[1]
|
y: pout[1]
|
||||||
.map(a => BASE.newPolygon(a).setOpen())
|
.map(a => BASE.newPolygon(a).setOpen())
|
||||||
// .filter(p => p.perimeter() > sdev.nozzleSize)
|
// .filter(p => p.perimeter() > nozzleSize)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +375,7 @@ var gs_kiri_fdm = exports;
|
||||||
var widgets = print.widgets,
|
var widgets = print.widgets,
|
||||||
settings = print.settings,
|
settings = print.settings,
|
||||||
device = settings.device,
|
device = settings.device,
|
||||||
nozzle = device.nozzleSize,
|
nozzle = device.extruders[0].extNozzle,
|
||||||
process = settings.process,
|
process = settings.process,
|
||||||
mode = settings.mode,
|
mode = settings.mode,
|
||||||
output = print.output,
|
output = print.output,
|
||||||
|
|
@ -374,7 +384,6 @@ var gs_kiri_fdm = exports;
|
||||||
maxLayers = 0,
|
maxLayers = 0,
|
||||||
layer = 0,
|
layer = 0,
|
||||||
zoff = 0,
|
zoff = 0,
|
||||||
mesh,
|
|
||||||
meshIndex,
|
meshIndex,
|
||||||
lastIndex,
|
lastIndex,
|
||||||
closest,
|
closest,
|
||||||
|
|
@ -382,7 +391,6 @@ var gs_kiri_fdm = exports;
|
||||||
minidx,
|
minidx,
|
||||||
find,
|
find,
|
||||||
found,
|
found,
|
||||||
mslices,
|
|
||||||
layerout = [],
|
layerout = [],
|
||||||
slices = [],
|
slices = [],
|
||||||
sliceEntry;
|
sliceEntry;
|
||||||
|
|
@ -510,9 +518,9 @@ var gs_kiri_fdm = exports;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// create list of mesh slice arrays with their platform offsets
|
// create list of mesh slice arrays with their platform offsets
|
||||||
for (meshIndex = 0; meshIndex < widgets.length; meshIndex++) {
|
for (meshIndex = 0; meshIndex < widgets.length; meshIndex++) {
|
||||||
mesh = widgets[meshIndex].mesh;
|
let mesh = widgets[meshIndex].mesh;
|
||||||
if (!mesh.widget) continue;
|
if (!mesh.widget) continue;
|
||||||
mslices = mesh.widget.slices;
|
let mslices = mesh.widget.slices;
|
||||||
if (mslices && mslices[layer]) {
|
if (mslices && mslices[layer]) {
|
||||||
slices.push({slice:mslices[layer], offset:mesh.position});
|
slices.push({slice:mslices[layer], offset:mesh.position});
|
||||||
}
|
}
|
||||||
|
|
@ -582,10 +590,14 @@ var gs_kiri_fdm = exports;
|
||||||
var layers = print.output,
|
var layers = print.output,
|
||||||
settings = print.settings,
|
settings = print.settings,
|
||||||
device = settings.device,
|
device = settings.device,
|
||||||
|
extruders = device.extruders,
|
||||||
process = settings.process,
|
process = settings.process,
|
||||||
fan_power = device.gcodeFan,
|
fan_power = device.gcodeFan,
|
||||||
trackLayers = device.gcodeLayer,
|
trackLayers = device.gcodeLayer,
|
||||||
trackProgress = device.gcodeTrack,
|
trackProgress = device.gcodeTrack,
|
||||||
|
extruder = 0,
|
||||||
|
nozzleSize = extruders[extruder].extNozzle,
|
||||||
|
filamentSize = extruders[extruder].extFilament,
|
||||||
time = 0,
|
time = 0,
|
||||||
layer = 0,
|
layer = 0,
|
||||||
pause = [],
|
pause = [],
|
||||||
|
|
@ -635,6 +647,8 @@ var gs_kiri_fdm = exports;
|
||||||
lines = 0,
|
lines = 0,
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
|
|
||||||
|
// console.log({print: print.widgets, meta:settings.widget, extruders, nozzleSize, filamentSize});
|
||||||
|
|
||||||
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
||||||
var v = parseInt(lv);
|
var v = parseInt(lv);
|
||||||
if (v >= 0) pause.push(v);
|
if (v >= 0) pause.push(v);
|
||||||
|
|
@ -738,9 +752,10 @@ var gs_kiri_fdm = exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calc total distance traveled by head as proxy for progress
|
// calc total distance traveled by head as proxy for progress
|
||||||
var allout = [],
|
var allout = [], totaldistance = 0;
|
||||||
totaldistance = 0;
|
layers.forEach(function(outs) {
|
||||||
layers.forEach(function(outs) { allout.appendAll(outs) });
|
allout.appendAll(outs);
|
||||||
|
});
|
||||||
allout.forEachPair(function (o1, o2) {
|
allout.forEachPair(function (o1, o2) {
|
||||||
totaldistance += o1.point.distTo2D(o2.point);
|
totaldistance += o1.point.distTo2D(o2.point);
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
@ -751,8 +766,8 @@ var gs_kiri_fdm = exports;
|
||||||
while (layer < layers.length) {
|
while (layer < layers.length) {
|
||||||
path = layers[layer];
|
path = layers[layer];
|
||||||
emitPerMM = print.extrudePerMM(
|
emitPerMM = print.extrudePerMM(
|
||||||
device.nozzleSize,
|
nozzleSize,
|
||||||
device.filamentSize,
|
filamentSize,
|
||||||
path.layer === 0 ?
|
path.layer === 0 ?
|
||||||
(process.firstSliceHeight || process.sliceHeight) : path.height);
|
(process.firstSliceHeight || process.sliceHeight) : path.height);
|
||||||
|
|
||||||
|
|
@ -812,6 +827,18 @@ var gs_kiri_fdm = exports;
|
||||||
out = path[pidx];
|
out = path[pidx];
|
||||||
speedMMM = (out.speed || process.outputFeedrate) * 60;
|
speedMMM = (out.speed || process.outputFeedrate) * 60;
|
||||||
|
|
||||||
|
// look for extruder change and recalc emit factor
|
||||||
|
if (out.tool !== undefined && out.tool !== extruder) {
|
||||||
|
extruder = out.tool;
|
||||||
|
nozzleSize = extruders[extruder].extNozzle;
|
||||||
|
filamentSize = extruders[extruder].extFilament;
|
||||||
|
emitPerMM = print.extrudePerMM(
|
||||||
|
nozzleSize,
|
||||||
|
filamentSize,
|
||||||
|
path.layer === 0 ?
|
||||||
|
(process.firstSliceHeight || process.sliceHeight) : path.height);
|
||||||
|
}
|
||||||
|
|
||||||
// if no point in output, it's a dwell command
|
// if no point in output, it's a dwell command
|
||||||
if (!out.point) {
|
if (!out.point) {
|
||||||
dwell(out.speed);
|
dwell(out.speed);
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ let gs_kiri_export = exports;
|
||||||
let density = $('print-density');
|
let density = $('print-density');
|
||||||
$('print-weight').value = (
|
$('print-weight').value = (
|
||||||
(Math.PI * UTIL.sqr(
|
(Math.PI * UTIL.sqr(
|
||||||
currentPrint.settings.device.filamentSize / 2
|
currentPrint.settings.device.extruders[0].extFilament / 2
|
||||||
)) *
|
)) *
|
||||||
currentPrint.distance *
|
currentPrint.distance *
|
||||||
(parseFloat(density.value) || 1.25) /
|
(parseFloat(density.value) || 1.25) /
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ let gs_kiri_print = exports;
|
||||||
seq = [],
|
seq = [],
|
||||||
abs = true,
|
abs = true,
|
||||||
move = false,
|
move = false,
|
||||||
|
tool = 0,
|
||||||
E0G0 = false,
|
E0G0 = false,
|
||||||
G0 = function() {
|
G0 = function() {
|
||||||
move = true;
|
move = true;
|
||||||
|
|
@ -166,7 +167,8 @@ let gs_kiri_print = exports;
|
||||||
seq,
|
seq,
|
||||||
{x:pos.X + off.X, y:pos.Y + off.Y, z:pos.Z + off.Z},
|
{x:pos.X + off.X, y:pos.Y + off.Y, z:pos.Z + off.Z},
|
||||||
!move,
|
!move,
|
||||||
pos.F
|
pos.F,
|
||||||
|
tool
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'M6':
|
case 'M6':
|
||||||
|
|
@ -462,17 +464,17 @@ let gs_kiri_print = exports;
|
||||||
array.push(new Output(point, emit, speed, tool));
|
array.push(new Output(point, emit, speed, tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
function segmentOutput(output, p1, p2, s1, s2, steps, mult) {
|
// function segmentedOutput(output, p1, p2, s1, s2, steps, mult) {
|
||||||
let sd = (s2 - s1) / (steps + 1);
|
// let sd = (s2 - s1) / (steps + 1);
|
||||||
let dd = p1.distTo2D(p2) / steps;
|
// let dd = p1.distTo2D(p2) / steps;
|
||||||
let dist = dd;
|
// let dist = dd;
|
||||||
let spd = s1;
|
// let spd = s1;
|
||||||
while (steps-- > 0) {
|
// while (steps-- > 0) {
|
||||||
spd += sd;
|
// spd += sd;
|
||||||
p1 = p1.offsetPointTo(p2, dd);
|
// p1 = p1.offsetPointTo(p2, dd);
|
||||||
addOutput(output, p1, mult, spd);
|
// addOutput(output, p1, mult, spd);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FDM & Laser. add points in polygon to an output array (print path)
|
* FDM & Laser. add points in polygon to an output array (print path)
|
||||||
|
|
@ -499,7 +501,8 @@ let gs_kiri_print = exports;
|
||||||
first = true,
|
first = true,
|
||||||
last = startPoint,
|
last = startPoint,
|
||||||
wipeDist = options.wipe || 0,
|
wipeDist = options.wipe || 0,
|
||||||
coastDist = options.coast || 0;
|
coastDist = options.coast || 0,
|
||||||
|
tool = options.tool;
|
||||||
|
|
||||||
// if short, use calculated print speed based on sliding scale
|
// if short, use calculated print speed based on sliding scale
|
||||||
if (perimeter < process.outputShortPoly) {
|
if (perimeter < process.outputShortPoly) {
|
||||||
|
|
@ -512,7 +515,7 @@ let gs_kiri_print = exports;
|
||||||
options.onfirst(point);
|
options.onfirst(point);
|
||||||
}
|
}
|
||||||
// move from startPoint to point
|
// move from startPoint to point
|
||||||
addOutput(output, point, 0, moveSpeed);
|
addOutput(output, point, 0, moveSpeed, tool);
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
let seglen = last.distTo2D(point);
|
let seglen = last.distTo2D(point);
|
||||||
|
|
@ -520,11 +523,11 @@ let gs_kiri_print = exports;
|
||||||
let delta = perimeter - coastDist;
|
let delta = perimeter - coastDist;
|
||||||
let offset = seglen - delta;
|
let offset = seglen - delta;
|
||||||
let offPoint = last.offsetPointFrom(point, offset)
|
let offPoint = last.offsetPointFrom(point, offset)
|
||||||
addOutput(output, offPoint, shellMult, printSpeed);
|
addOutput(output, offPoint, shellMult, printSpeed, tool);
|
||||||
shellMult = 0;
|
shellMult = 0;
|
||||||
}
|
}
|
||||||
perimeter -= seglen;
|
perimeter -= seglen;
|
||||||
addOutput(output, point, shellMult, printSpeed);
|
addOutput(output, point, shellMult, printSpeed, tool);
|
||||||
}
|
}
|
||||||
last = point;
|
last = point;
|
||||||
}, true, closest.index);
|
}, true, closest.index);
|
||||||
|
|
@ -543,16 +546,19 @@ let gs_kiri_print = exports;
|
||||||
* @return {Point} last output point
|
* @return {Point} last output point
|
||||||
*/
|
*/
|
||||||
PRO.slicePrintPath = function(slice, startPoint, offset, output, options) {
|
PRO.slicePrintPath = function(slice, startPoint, offset, output, options) {
|
||||||
|
// console.log({slicePrintPath: slice.index, ext:slice.extruder});
|
||||||
|
|
||||||
let i,
|
let i,
|
||||||
opt = options || {},
|
opt = options || {},
|
||||||
preout = [],
|
preout = [],
|
||||||
scope = this,
|
scope = this,
|
||||||
settings = this.settings,
|
settings = this.settings,
|
||||||
process = settings.process,
|
process = settings.process,
|
||||||
nozzle = settings.device.nozzleSize,
|
extruder = slice.extruder || 0,
|
||||||
|
nozzleSize = settings.device.extruders[extruder].extNozzle,
|
||||||
firstLayer = opt.first || false,
|
firstLayer = opt.first || false,
|
||||||
minSeek = nozzle * (opt.minSeek || 1.5),
|
minSeek = nozzleSize * (opt.minSeek || 1.5),
|
||||||
thinWall = nozzle * (opt.thinWall || 1.75),
|
thinWall = nozzleSize * (opt.thinWall || 1.75),
|
||||||
retractDist = opt.retractOver || 2,
|
retractDist = opt.retractOver || 2,
|
||||||
fillMult = opt.mult || process.outputFillMult,
|
fillMult = opt.mult || process.outputFillMult,
|
||||||
shellMult = opt.mult || process.outputShellMult || (process.laserSliceHeight >= 0 ? 1 : 0),
|
shellMult = opt.mult || process.outputShellMult || (process.laserSliceHeight >= 0 ? 1 : 0),
|
||||||
|
|
@ -603,6 +609,7 @@ let gs_kiri_print = exports;
|
||||||
} else {
|
} else {
|
||||||
let finishShell = poly.depth === 0 && !firstLayer;
|
let finishShell = poly.depth === 0 && !firstLayer;
|
||||||
startPoint = scope.polyPrintPath(poly, startPoint, preout, {
|
startPoint = scope.polyPrintPath(poly, startPoint, preout, {
|
||||||
|
tool: extruder,
|
||||||
rate: finishShell ? finishSpeed : printSpeed,
|
rate: finishShell ? finishSpeed : printSpeed,
|
||||||
accel: finishShell,
|
accel: finishShell,
|
||||||
wipe: process.outputWipeDistance || 0,
|
wipe: process.outputWipeDistance || 0,
|
||||||
|
|
@ -636,7 +643,7 @@ let gs_kiri_print = exports;
|
||||||
if (i === 0 && lp && lp.distTo2D(p) > retractDist && intersectsTop(lp,p)) {
|
if (i === 0 && lp && lp.distTo2D(p) > retractDist && intersectsTop(lp,p)) {
|
||||||
retract();
|
retract();
|
||||||
}
|
}
|
||||||
addOutput(preout, p, i === 0 ? 0 : extrude, speed || printSpeed);
|
addOutput(preout, p, i === 0 ? 0 : extrude, speed || printSpeed, extruder);
|
||||||
lp = p;
|
lp = p;
|
||||||
});
|
});
|
||||||
return lp;
|
return lp;
|
||||||
|
|
@ -716,7 +723,7 @@ let gs_kiri_print = exports;
|
||||||
// to avoid shaking the printer to death.
|
// to avoid shaking the printer to death.
|
||||||
if (dist <= thinWall && len <= thinWall) {
|
if (dist <= thinWall && len <= thinWall) {
|
||||||
p2 = p1.midPointTo(p2);
|
p2 = p1.midPointTo(p2);
|
||||||
addOutput(preout, p2, fill * (dist / thinWall), fillSpeed);
|
addOutput(preout, p2, fill * (dist / thinWall), fillSpeed, extruder);
|
||||||
} else {
|
} else {
|
||||||
// retract if dist trigger or crosses a slice top polygon
|
// retract if dist trigger or crosses a slice top polygon
|
||||||
if (dist > retractDist && (zhop || intersectsTop(startPoint, p1))) {
|
if (dist > retractDist && (zhop || intersectsTop(startPoint, p1))) {
|
||||||
|
|
@ -725,17 +732,17 @@ let gs_kiri_print = exports;
|
||||||
|
|
||||||
// anti-backlash on longer move
|
// anti-backlash on longer move
|
||||||
if (antiBacklash && dist > retractDist) {
|
if (antiBacklash && dist > retractDist) {
|
||||||
addOutput(preout, p1.add({x:antiBacklash,y:-antiBacklash,z:0}), 0, moveSpeed);
|
addOutput(preout, p1.add({x:antiBacklash,y:-antiBacklash,z:0}), 0, moveSpeed, extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bridge ends of fill when they're close together
|
// bridge ends of fill when they're close together
|
||||||
if (dist < thinWall) {
|
if (dist < thinWall) {
|
||||||
addOutput(preout, p1, fill, fillSpeed);
|
addOutput(preout, p1, fill, fillSpeed, extruder);
|
||||||
} else {
|
} else {
|
||||||
addOutput(preout, p1, 0, moveSpeed);
|
addOutput(preout, p1, 0, moveSpeed, extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
addOutput(preout, p2, fill, fillSpeed);
|
addOutput(preout, p2, fill, fillSpeed, extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
startPoint = p2;
|
startPoint = p2;
|
||||||
|
|
@ -845,7 +852,7 @@ let gs_kiri_print = exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add offset points to total print
|
// add offset points to total print
|
||||||
addPrintPoints(preout, output, origin);
|
addPrintPoints(preout, output, origin, extruder);
|
||||||
|
|
||||||
return startPoint.add(offset);
|
return startPoint.add(offset);
|
||||||
};
|
};
|
||||||
|
|
@ -856,9 +863,9 @@ let gs_kiri_print = exports;
|
||||||
* @param {Point[]} output
|
* @param {Point[]} output
|
||||||
* @param {Point} [startPoint]
|
* @param {Point} [startPoint]
|
||||||
*/
|
*/
|
||||||
function addPrintPoints(input, output, startPoint) {
|
function addPrintPoints(input, output, startPoint, tool) {
|
||||||
if (startPoint && input.length > 0) {
|
if (startPoint && input.length > 0) {
|
||||||
addOutput(output, startPoint, 0);
|
addOutput(output, startPoint, 0, undefined, tool);
|
||||||
}
|
}
|
||||||
output.appendAll(input);
|
output.appendAll(input);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
js/kiri.js
15
js/kiri.js
|
|
@ -847,7 +847,17 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
SPACE.update();
|
SPACE.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
function scaleSelection(ev) {
|
function scaleSelection() {
|
||||||
|
if (arguments.length === 1) {
|
||||||
|
scaleSelectionUI(...arguments);
|
||||||
|
} else {
|
||||||
|
forSelectedGroups(function (w) {
|
||||||
|
w.scale(...arguments);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scaleSelectionUI(ev) {
|
||||||
let dv = parseFloat(ev.target.value || 1);
|
let dv = parseFloat(ev.target.value || 1);
|
||||||
if (UI.scaleUniform.checked) {
|
if (UI.scaleUniform.checked) {
|
||||||
UI.scaleX.value = dv;
|
UI.scaleX.value = dv;
|
||||||
|
|
@ -1052,6 +1062,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
function platformAdd(widget, shift, nolayout) {
|
function platformAdd(widget, shift, nolayout) {
|
||||||
|
settings.widget[widget.id] = {extruder: 0};
|
||||||
WIDGETS.push(widget);
|
WIDGETS.push(widget);
|
||||||
SPACE.platform.add(widget.mesh);
|
SPACE.platform.add(widget.mesh);
|
||||||
platform.select(widget, shift);
|
platform.select(widget, shift);
|
||||||
|
|
@ -1076,6 +1087,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KIRI.work.clear(widget);
|
KIRI.work.clear(widget);
|
||||||
|
delete settings.widget[widget.id];
|
||||||
WIDGETS.remove(widget);
|
WIDGETS.remove(widget);
|
||||||
Widget.Groups.remove(widget);
|
Widget.Groups.remove(widget);
|
||||||
SPACE.platform.remove(widget.mesh);
|
SPACE.platform.remove(widget.mesh);
|
||||||
|
|
@ -1352,7 +1364,6 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
// store camera view
|
// store camera view
|
||||||
let view = SPACE.view.save();
|
let view = SPACE.view.save();
|
||||||
if (view.left || view.up) settings.controller.view = view;
|
if (view.left || view.up) settings.controller.view = view;
|
||||||
// CONF.normalize(settings);
|
|
||||||
SDB.setItem('ws-settings', JSON.stringify(settings));
|
SDB.setItem('ws-settings', JSON.stringify(settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue