switch to explicit layer height & speed for first layer. add slice error handling
This commit is contained in:
parent
cddb2d1747
commit
c1fdd341f7
6 changed files with 72 additions and 42 deletions
|
|
@ -430,11 +430,11 @@ var gs_base_polygons = exports;
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {Polygon} poly
|
||||
* @param {Polygon[]} traces
|
||||
* @param {number} offset
|
||||
* @param {number} count
|
||||
* @param {number} depth
|
||||
* @param {Polygon} poly input
|
||||
* @param {Polygon[]} traces output
|
||||
* @param {number} offset distance to offset
|
||||
* @param {number} count number of offsets
|
||||
* @param {number} depth current depth (count) into offsets
|
||||
* @param {Polygon[]} [last]
|
||||
* @param {Polygon[]} [first]
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ var gs_kiri_fdm = exports;
|
|||
|
||||
var KIRI = self.kiri,
|
||||
BASE = self.base,
|
||||
DBUG = BASE.debug,
|
||||
UTIL = BASE.util,
|
||||
CONF = BASE.config,
|
||||
FDM = KIRI.driver.FDM = { },
|
||||
|
|
@ -48,15 +49,20 @@ var gs_kiri_fdm = exports;
|
|||
sliceFillAngle = spro.sliceFillAngle,
|
||||
view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null;
|
||||
|
||||
if (spro.sliceHeight <= 0.01) {
|
||||
DBUG.log("invalid slice height");
|
||||
return ondone(null);
|
||||
if (spro.sliceHeight < 0.01) {
|
||||
return ondone("invalid slice height");
|
||||
}
|
||||
|
||||
if (spro.firstSliceHeight < spro.sliceHeight) {
|
||||
DBUG.log("invalid first layer height < slice height");
|
||||
DBUG.log("reverting to slice height");
|
||||
spro.firstSliceHeight = spro.sliceHeight;
|
||||
}
|
||||
|
||||
SLICER.sliceWidget(widget, {
|
||||
height: spro.sliceHeight,
|
||||
view:view,
|
||||
firstHeight: spro.sliceHeight * sout.firstLayerHeight
|
||||
firstHeight: sout.firstSliceHeight
|
||||
}, onSliceDone, onSliceUpdate);
|
||||
|
||||
function onSliceUpdate(update) {
|
||||
|
|
@ -219,11 +225,18 @@ var gs_kiri_fdm = exports;
|
|||
|
||||
printPoint = print.poly2polyEmit(polys, printPoint, function(poly, index, count, startPoint) {
|
||||
return print.polyPrintPath(poly, startPoint, preout, {
|
||||
rate: process.firstLayerSpeed * process.outputFeedrate
|
||||
rate: process.firstLayerRate,
|
||||
onfirst: function(point) {
|
||||
if (preout.length && point.distTo2D(startPoint) > 2) {
|
||||
// retract between brim r
|
||||
preout.last().retract = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
print.addPrintPoints(preout, layerout, startPoint);
|
||||
preout.last().retract = true;
|
||||
}
|
||||
|
||||
// iterate over layer slices, find closest widget, print, eliminate
|
||||
|
|
@ -275,7 +288,7 @@ var gs_kiri_fdm = exports;
|
|||
pos = {x:0, y:0, z:0, f:0},
|
||||
last = null,
|
||||
zinc = process.sliceHeight,
|
||||
zpos = zinc * process.firstLayerHeight,
|
||||
zpos = process.firstSliceHeight,
|
||||
offset = process.outputOriginCenter ? null : {
|
||||
x: device.bedWidth/2,
|
||||
y: device.bedDepth/2
|
||||
|
|
@ -298,7 +311,7 @@ var gs_kiri_fdm = exports;
|
|||
// ratio of nozzle area to filament area times
|
||||
// ratio of slice height to filament max noodle height
|
||||
emitPerMM = print.extrudePerMM(device.nozzleSize, device.filamentSize, process.sliceHeight),
|
||||
emitPerMMLayer1 = print.extrudePerMM(device.nozzleSize, device.filamentSize, process.sliceHeight * process.firstLayerHeight),
|
||||
emitPerMMLayer1 = print.extrudePerMM(device.nozzleSize, device.filamentSize, process.firstSliceHeight),
|
||||
constReplace = print.constReplace,
|
||||
pidx, path, out, speedMMM, emitMM, lastp, laste, dist,
|
||||
appendAll = function(arr) {
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ var gs_kiri_print = exports;
|
|||
sparseMult = process.outputSparseMult,
|
||||
wipeDistance = process.outputWipeDistance,
|
||||
wipeSpeed = process.outputWipeSpeed || 20,
|
||||
firstSpeed = process.firstLayerSpeed * process.outputFeedrate,
|
||||
firstSpeed = process.firstLayerRate,
|
||||
printSpeed = firstLayer ? firstSpeed : process.outputFeedrate,
|
||||
moveSpeed = process.outputSeekrate,
|
||||
origin = startPoint.add(offset),
|
||||
|
|
@ -653,7 +653,10 @@ var gs_kiri_print = exports;
|
|||
}
|
||||
|
||||
/**
|
||||
* given array of polygons, emit them in next closest order
|
||||
* given array of polygons, emit them in next closest order with
|
||||
* the special exception that depth is considered into distance
|
||||
* so that inner polygons are emitted first.
|
||||
*
|
||||
* @param {Array} array of Polygon or Polygon wrappers
|
||||
* @param {Function} fn
|
||||
* @param {Function} fnp convert 'next' object into a Polygon
|
||||
|
|
@ -786,9 +789,10 @@ var gs_kiri_print = exports;
|
|||
}
|
||||
|
||||
/**
|
||||
* like tip2tipEmit but accepts an array of
|
||||
* polygons and the next closest point can
|
||||
* be anywhere in the adjacent polygon
|
||||
* like tip2tipEmit but accepts an array of polygons and the next closest
|
||||
* point can be anywhere in the adjacent polygon. should be re-written
|
||||
* to be more like outputOrderClosest() and have the option to account for
|
||||
* depth in determining distance
|
||||
*/
|
||||
function poly2polyEmit(array, startPoint, emitter) {
|
||||
var mindist, dist, found, count = 0;
|
||||
|
|
|
|||
|
|
@ -551,6 +551,9 @@ var gs_kiri_widget = exports;
|
|||
ondone(true);
|
||||
widget.modified = false;
|
||||
}
|
||||
if (reply.error) {
|
||||
alert(reply.error);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
|
@ -558,12 +561,17 @@ var gs_kiri_widget = exports;
|
|||
// executed from kiri-worker.js
|
||||
widget.clearSlices();
|
||||
|
||||
var catchdone = function() {
|
||||
var catchdone = function(error) {
|
||||
if (error) {
|
||||
return ondone(error);
|
||||
}
|
||||
|
||||
onupdate(1.0, "transferring");
|
||||
|
||||
widget.stats.slice_time = UTIL.time() - startTime;
|
||||
widget.modified = false;
|
||||
|
||||
ondone(true);
|
||||
ondone();
|
||||
};
|
||||
|
||||
var catchupdate = function(progress, message) {
|
||||
|
|
@ -583,7 +591,7 @@ var gs_kiri_widget = exports;
|
|||
driver.slice(settings, widget, catchupdate, catchdone);
|
||||
} else {
|
||||
DBUG.log('invalid mode: '+settings.mode);
|
||||
ondone(false);
|
||||
ondone('invalid mode: '+settings.mode);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ if (self.window) {
|
|||
};
|
||||
|
||||
} else {
|
||||
|
||||
module = { exports: {} };
|
||||
|
||||
var loc = self.location,
|
||||
|
|
@ -195,25 +196,30 @@ if (self.window) {
|
|||
position: position
|
||||
};
|
||||
|
||||
widget.slice(settings, function() {
|
||||
send.data({send_start:time()});
|
||||
send.data({
|
||||
topo: settings.synth.sendTopo ? widget.topo : null,
|
||||
stats: widget.stats,
|
||||
slices: widget.slices.length
|
||||
});
|
||||
widget.slices.forEach(function(slice,index) {
|
||||
send.data({index:index, slice:slice.encode()});
|
||||
})
|
||||
send.data({send_end:time()});
|
||||
send.done({done:true});
|
||||
widget.slice(settings, function(error) {
|
||||
if (error) {
|
||||
send.data({error: error});
|
||||
} else {
|
||||
var slices = widget.slices || [];
|
||||
send.data({send_start: time()});
|
||||
send.data({
|
||||
topo: settings.synth.sendTopo ? widget.topo : null,
|
||||
stats: widget.stats,
|
||||
slices: slices.length
|
||||
});
|
||||
slices.forEach(function(slice,index) {
|
||||
send.data({index: index, slice: slice.encode()});
|
||||
})
|
||||
send.data({send_end: time()});
|
||||
}
|
||||
send.done({done: true});
|
||||
// cache results for future printing
|
||||
cache[data.id] = widget;
|
||||
}, function(update, msg) {
|
||||
now = util.time();
|
||||
if (now - last < 10 && update < 0.99) return;
|
||||
// on update
|
||||
send.data({update:(0.05 + update * 0.95), updateStatus:msg});
|
||||
send.data({update: (0.05 + update * 0.95), updateStatus: msg});
|
||||
last = now;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
17
js/kiri.js
17
js/kiri.js
|
|
@ -61,8 +61,8 @@ self.kiri.license = exports.LICENSE;
|
|||
sliceBottomLayers: 1,
|
||||
sliceTopLayers: 1,
|
||||
sliceVase: 1,
|
||||
firstLayerHeight: 1,
|
||||
firstLayerSpeed: 1,
|
||||
firstSliceHeight: 1,
|
||||
firstLayerRate: 1,
|
||||
outputTemp: 1,
|
||||
outputFanMax: 1,
|
||||
outputBedTemp: 1,
|
||||
|
|
@ -254,8 +254,8 @@ self.kiri.license = exports.LICENSE;
|
|||
sliceTopLayers: 2,
|
||||
sliceVase: false,
|
||||
|
||||
firstLayerHeight: 1.0,
|
||||
firstLayerSpeed: 0.5,
|
||||
firstSliceHeight: 0.25,
|
||||
firstLayerRate: 30,
|
||||
|
||||
outputTemp: 230,
|
||||
outputFanMax: 255,
|
||||
|
|
@ -995,7 +995,7 @@ self.kiri.license = exports.LICENSE;
|
|||
ajax(host+"/api/check?key="+key, function(data) {
|
||||
data = js2o(data);
|
||||
DBUG.log(data);
|
||||
if (!data.done) setTimeout(function() { gridprint_tracker(host,key) }, 1000);
|
||||
if (!data.done && !data.error) setTimeout(function() { gridprint_tracker(host,key) }, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -2234,7 +2234,7 @@ self.kiri.license = exports.LICENSE;
|
|||
UI.settingsLoad =
|
||||
UC.newButton("load", settingsLoad),
|
||||
UI.settingsSave =
|
||||
UC.newButton("save", settingsSave),
|
||||
UC.newButton("save", settingsSave)
|
||||
]
|
||||
]),
|
||||
|
||||
|
|
@ -2243,7 +2243,6 @@ self.kiri.license = exports.LICENSE;
|
|||
bedDepth: UC.newInput("depth", {title:"millimeters", convert:UC.toInt, modes:LASER}),
|
||||
|
||||
process: UC.newGroup("process", control, {modes:FDM_LASER}),
|
||||
processName: UC.newInput("name", {modes:[]}),
|
||||
|
||||
// 3d print
|
||||
sliceHeight: UC.newInput("slice height", {title:"millimeters", convert:UC.toFloat, modes:FDM}),
|
||||
|
|
@ -2348,8 +2347,8 @@ self.kiri.license = exports.LICENSE;
|
|||
sliceSupportEnable: UC.newBoolean("enable", onBooleanClick, {modes:FDM}),
|
||||
|
||||
firstLayer: UC.newGroup("first layer", null, {modes:FDM}),
|
||||
firstLayerHeight: UC.newInput("height factor", {title:"0.5 - 2.5\nmultiplier on slice height\nshould be no more\nthan 80% nozzle diam", convert:UC.toFloat, modes:FDM}),
|
||||
firstLayerSpeed: UC.newInput("speed factor", {title:"0.1 - 1.0\nmultiplier on print speed", convert:UC.toFloat, modes:FDM}),
|
||||
firstSliceHeight: UC.newInput("slice height", {title:"in millimeters\nshould be >= slice height", convert:UC.toFloat, modes:FDM}),
|
||||
firstLayerRate: UC.newInput("print speed", {title:"print move max speed\nmillimeters / minute", convert:UC.toFloat, modes:FDM}),
|
||||
outputBrimCount: UC.newInput("skirt count", {title:"number of skirts", convert:UC.toInt, modes:FDM}),
|
||||
outputBrimOffset: UC.newInput("skirt offset", {title:"millimeters", convert:UC.toFloat, modes:FDM}),
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue