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