replace fill density with fill spacing for consistency with shells

This commit is contained in:
Stewart Allen 2017-10-30 11:06:12 -04:00
commit fbe99720a0
4 changed files with 20 additions and 27 deletions

View file

@ -44,6 +44,7 @@ var gs_kiri_fdm = exports;
firstOffset = spri.nozzleSize / 2, firstOffset = spri.nozzleSize / 2,
shellOffset = spri.nozzleSize * spro.sliceShellSpacing, shellOffset = spri.nozzleSize * spro.sliceShellSpacing,
fillOffset = shellOffset * settings.synth.fillOffsetMult, fillOffset = shellOffset * settings.synth.fillOffsetMult,
fillSpacing = spri.nozzleSize * spro.sliceFillSpacing,
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;
@ -101,7 +102,7 @@ var gs_kiri_fdm = exports;
spro.sliceFillSparse > 0.95 spro.sliceFillSparse > 0.95
) && !spro.sliceVase; ) && !spro.sliceVase;
slice.doShells(spro.sliceShells, firstOffset, shellOffset, fillOffset, spro.sliceVase); slice.doShells(spro.sliceShells, firstOffset, shellOffset, fillOffset, spro.sliceVase);
if (solid) slice.doSolidLayerFill(spri.nozzleSize, sliceFillAngle, spro.sliceFillDensity); if (solid) slice.doSolidLayerFill(fillSpacing, sliceFillAngle);
sliceFillAngle += 90.0; sliceFillAngle += 90.0;
}, "offsets"); }, "offsets");
@ -115,7 +116,7 @@ var gs_kiri_fdm = exports;
slice.projectBridges(solidLayers); slice.projectBridges(solidLayers);
}, "solids"); }, "solids");
forSlices(0.35, 0.5, function(slice) { forSlices(0.35, 0.5, function(slice) {
slice.doSolidsFill(spri.nozzleSize, sliceFillAngle, spro.sliceFillDensity, minSolid); slice.doSolidsFill(fillSpacing, sliceFillAngle, minSolid);
sliceFillAngle += 90.0; sliceFillAngle += 90.0;
}, "solids"); }, "solids");
} }
@ -133,7 +134,7 @@ var gs_kiri_fdm = exports;
// sparse layers only present when non-vase mose and sparse % > 0 // sparse layers only present when non-vase mose and sparse % > 0
if (!spro.sliceVase && spro.sliceFillSparse > 0.0) { if (!spro.sliceVase && spro.sliceFillSparse > 0.0) {
forSlices(0.8, 1.0, function(slice) { forSlices(0.8, 1.0, function(slice) {
slice.doSparseLayerFill(spri.nozzleSize, spro.sliceFillDensity, spro.sliceFillSparse, widget.getBoundingBox()); slice.doSparseLayerFill(fillSpacing, spro.sliceFillSparse, widget.getBoundingBox());
}, "infill"); }, "infill");
} }

View file

@ -468,7 +468,7 @@ var gs_kiri_slice = exports;
* @param {number} angle * @param {number} angle
* @param {number} density * @param {number} density
*/ */
PRO.doSolidLayerFill = function(linewidth, angle, density) { PRO.doSolidLayerFill = function(spacing, angle) {
this.isSolidFill = false; this.isSolidFill = false;
if (this.tops.length === 0) return; if (this.tops.length === 0) return;
@ -476,9 +476,6 @@ var gs_kiri_slice = exports;
var debug = (this.index === DBUG.get('z-index')) && DBUG.get('layer-solid'); var debug = (this.index === DBUG.get('z-index')) && DBUG.get('layer-solid');
// effective nozzle_width: adjusted for desired density
var spacing = linewidth * (1 / density);
this.tops.forEach(function(top) { this.tops.forEach(function(top) {
if (top.inner && top.inner.length > 0) { if (top.inner && top.inner.length > 0) {
top.fill_lines = fillArea(top.inner, angle, spacing); top.fill_lines = fillArea(top.inner, angle, spacing);
@ -510,18 +507,16 @@ var gs_kiri_slice = exports;
* Take output from pluggable sparse infill algorithm and clip to * Take output from pluggable sparse infill algorithm and clip to
* the bounds of the top polygons and their inner solid areas. * the bounds of the top polygons and their inner solid areas.
* *
* @param {number} linewidth (nozzle width) * @param {number} spacing space between fill lines
* @param {number} density spacing overlap (0.0 - 1.0)
* @param {number} percent infill 0.0 - 1.0 * @param {number} percent infill 0.0 - 1.0
* @param {Object} bounds -- TODO calc w/out mesh so it can run in a worker * @param {Object} bounds -- TODO calc w/out mesh so it can run in a worker
*/ */
PRO.doSparseLayerFill = function(linewidth, density, percent, bounds) { PRO.doSparseLayerFill = function(spacing, percent, bounds) {
this.isSparseFill = false; this.isSparseFill = false;
if (this.tops.length === 0 || percent === 0.0 || this.isSolidFill) return; if (this.tops.length === 0 || percent === 0.0 || this.isSolidFill) return;
var scope = this, var scope = this,
tops = scope.tops, tops = scope.tops,
spacing = linewidth * (1 / density),
clib = self.ClipperLib, clib = self.ClipperLib,
ctyp = clib.ClipType, ctyp = clib.ClipType,
ptyp = clib.PolyType, ptyp = clib.PolyType,
@ -681,7 +676,7 @@ var gs_kiri_slice = exports;
* fill projected areas and store line data * fill projected areas and store line data
* @return {boolean} true if filled, false if not * @return {boolean} true if filled, false if not
*/ */
PRO.doSolidsFill = function(linewidth, angle, density, minArea) { PRO.doSolidsFill = function(spacing, angle, minArea) {
var minarea = minArea || 1, var minarea = minArea || 1,
scope = this, scope = this,
@ -716,9 +711,6 @@ var gs_kiri_slice = exports;
if (debug) DBUG.log(['project', this.index, polys.length, unioned.length, inner.length]); if (debug) DBUG.log(['project', this.index, polys.length, unioned.length, inner.length]);
// effective nozzle_width: adjusted for desired density
var spacing = linewidth * (1 / density);
// clear old solids and make array for new // clear old solids and make array for new
tops.forEach(function(top) { top.solids = [] }); tops.forEach(function(top) { top.solids = [] });

View file

@ -45,7 +45,7 @@ self.kiri.license = exports.LICENSE;
sliceShellSpacing: 1, sliceShellSpacing: 1,
sliceFillAngle: 1, sliceFillAngle: 1,
sliceFillOverlap: 1, sliceFillOverlap: 1,
sliceFillDensity: 1, sliceFillSpacing: 1,
sliceFillSparse: 1, sliceFillSparse: 1,
sliceSupportEnable: 1, sliceSupportEnable: 1,
sliceSupportDensity: 1, sliceSupportDensity: 1,
@ -226,7 +226,7 @@ self.kiri.license = exports.LICENSE;
sliceShellSpacing: 0.9, sliceShellSpacing: 0.9,
sliceFillAngle: 45, sliceFillAngle: 45,
sliceFillOverlap: 0.5, sliceFillOverlap: 0.5,
sliceFillDensity: 1.0, sliceFillSpacing: 1.0,
sliceFillSparse: 0.5, sliceFillSparse: 0.5,
sliceSupportEnable: false, sliceSupportEnable: false,
@ -2222,7 +2222,7 @@ self.kiri.license = exports.LICENSE;
sliceShells: UC.newInput("shell count", {convert:UC.toInt, modes:FDM}), sliceShells: UC.newInput("shell count", {convert:UC.toInt, modes:FDM}),
sliceShellSpacing: UC.newInput("shell spacing", {title:"as a percentage of nozzle width\n< 1.0 causes shell overlap\nrecommended 0.85 - 1.0", convert:UC.toFloat, bound:UC.bound(0.5,1.0), modes:FDM}), sliceShellSpacing: UC.newInput("shell spacing", {title:"as a percentage of nozzle width\n< 1.0 causes shell overlap\nrecommended 0.85 - 1.0", convert:UC.toFloat, bound:UC.bound(0.5,1.0), modes:FDM}),
sliceFillOverlap: UC.newInput("fill overlap", {title:"overlap with shell\nas % of nozzle width\nhigher bonds better\n0.0 - 1.0", convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}), sliceFillOverlap: UC.newInput("fill overlap", {title:"overlap with shell\nas % of nozzle width\nhigher bonds better\n0.0 - 1.0", convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}),
sliceFillDensity: UC.newInput("fill density", {title:"fill line density\n0.0 - 2.0", convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}), sliceFillSpacing: UC.newInput("fill spacing", {title:"as a percentage of nozzle width\n< 1.0 causes fill overlap\nrecommended 0.85 - 1.0", convert:UC.toFloat, bound:UC.bound(0.0,2.0), modes:FDM}),
sliceFillAngle: UC.newInput("fill angle", {title:"base angle in degrees", convert:UC.toFloat, modes:FDM}), sliceFillAngle: UC.newInput("fill angle", {title:"base angle in degrees", convert:UC.toFloat, modes:FDM}),
sliceFillSparse: UC.newInput("infill %", {title:"for solid layers\n0.0 - 1.0", convert:UC.toFloat, bound:UC.bound(0.0,1.0), modes:FDM}), sliceFillSparse: UC.newInput("infill %", {title:"for solid layers\n0.0 - 1.0", convert:UC.toFloat, bound:UC.bound(0.0,1.0), modes:FDM}),
sliceSolidMinArea: UC.newInput("solid area", {title:"minimum area (cm^2)\nrequired to keep solid\nmust be > 0.1", convert:UC.toFloat, modes:FDM}), sliceSolidMinArea: UC.newInput("solid area", {title:"minimum area (cm^2)\nrequired to keep solid\nmust be > 0.1", convert:UC.toFloat, modes:FDM}),

View file

@ -1,21 +1,21 @@
{ {
"pre":[ "pre":[
"M118 X15.00 Y15.00 Z10.00 T0", "M118 X15.00 Y15.00 Z10.00 T0",
"M104 S{temp} T0 ; set nozzle0 temp", "M104 S{temp} T0",
"M107 ; fan off", "M107",
"G90 ; set absolute positioning", "G90",
"M132 X Y Z A B ; set axis limits", "M132 X Y Z A B",
"M907 X100 Y100 Z40 A80 B20 ; set digital trimpots", "M907 X100 Y100 Z40 A80 B20",
"; pre-extrude", "; pre-extrude",
"G1 X-75 Y-75 Z0.35 F400", "G1 X-75 Y-75 Z0.35 F400",
"G1 X75 E25 F1800", "G1 X75 E25 F1800",
"G1 Y00 E20 F2400" "G1 Y00 E20 F2400"
], ],
"post":[ "post":[
"M107 ; fan off", "M107",
"M104 S0 T0 ; set nozzle0 temp", "M104 S0 T0",
"G162 Z ; lower bed", "G162 Z",
"M18 ; disable all steppers" "M18"
], ],
"cmd":{ "cmd":{
"fan_power": "M106 S{fan_speed}" "fan_power": "M106 S{fan_speed}"