diff --git a/src/settings/default.yml b/src/settings/default.yml index 0fd05a0..694cf51 100644 --- a/src/settings/default.yml +++ b/src/settings/default.yml @@ -2,49 +2,49 @@ dimensions: x: 200 y: 200 z: 200 -temperature: 210 -bedTemperature: 70 -# heatBedTemperature: 20 -# heatTemperature: 20 -# heatupEnabled: true -travelSpeed: 200.0 -layerHeight: 0.15 heatedBed: false nozzleDiameter: 0.4 filamentThickness: 2.85 +temperature: 210 +bedTemperature: 70 +layerHeight: 0.15 +brimOffset: 4.0 +thickness: + top: 1.2 + bottom: 1.2 + shell: 0.8 retraction: - amount: 3.0 enabled: true + amount: 3.0 speed: 50.0 minDistance: 0.0 +travel: + speed: 200.0 support: + enabled: false acceptanceMargin: 1.5 distanceY: 0.4 - enabled: false gridSize: 6.0 margin: 2.0 plateSize: 4.0 flowRate: 0.8 speed: 40.0 -outerLine: - flowRate: 1.0 - speed: 40.0 -innerLine: +innerShell: flowRate: 1.0 speed: 50.0 -fill: +outerShell: + flowRate: 1.0 + speed: 40.0 +innerInfill: flowRate: 1.0 speed: 50.0 gridSize: 5.0 +outerInfill: + flowRate: 1.0 + speed: 50.0 brim: flowRate: 1.0 speed: 40.0 - offset: 4.0 -top: - thickness: 1.2 -bottom: +firstLayer: flowRate: 1.2 speed: 40.0 - thickness: 0.4 -shell: - thickness: 0.4 diff --git a/src/sliceActions/generateInfills.js b/src/sliceActions/generateInfills.js index 31c4ec7..d071e55 100644 --- a/src/sliceActions/generateInfills.js +++ b/src/sliceActions/generateInfills.js @@ -5,15 +5,16 @@ import Shape from 'clipper-js'; export default function generateInfills(slices, settings) { let { layerHeight, - fill: { gridSize: fillGridSize }, - bottom: { thickness: bottomThickness }, - top: { thickness: topThickness }, + innerInfill: { gridSize: infillGridSize }, + thickness: { + top: topThickness, + bottom: bottomThickness + }, nozzleDiameter } = settings; - fillGridSize /= PRECISION; + infillGridSize /= PRECISION; nozzleDiameter /= PRECISION; - infillOverlap /= PRECISION; const bottomSkinCount = Math.ceil(bottomThickness/layerHeight); const topSkinCount = Math.ceil(topThickness/layerHeight); @@ -54,7 +55,7 @@ export default function generateInfills(slices, settings) { if (lowFillArea && lowFillArea.paths.length > 0) { const bounds = lowFillArea.shapeBounds(); - const lowFillTemplate = getFillTemplate(bounds, fillGridSize, true, true); + const lowFillTemplate = getFillTemplate(bounds, infillGridSize, true, true); part.fill.join(lowFillTemplate.intersect(lowFillArea)); } diff --git a/src/sliceActions/generateInnerLines.js b/src/sliceActions/generateInnerLines.js index cfab81e..2da441a 100644 --- a/src/sliceActions/generateInnerLines.js +++ b/src/sliceActions/generateInnerLines.js @@ -12,10 +12,12 @@ export default function generateInnerLines(slices, settings) { let { layerHeight, nozzleDiameter, - shell: { thickness: shellThickness } + thickness: { shell: shellThickness } } = settings; + nozzleDiameter /= PRECISION; shellThickness /= PRECISION; + const nozzleRadius = nozzleDiameter / 2; const shells = Math.round(shellThickness / nozzleDiameter); diff --git a/src/sliceActions/helpers/GCode.js b/src/sliceActions/helpers/GCode.js index c2e7f2f..c8df4ad 100644 --- a/src/sliceActions/helpers/GCode.js +++ b/src/sliceActions/helpers/GCode.js @@ -103,9 +103,9 @@ export default class { if (this._isRetracted && enabled) { this._isRetracted = false; - const speed = retractionSpeed * 60; + speed *= 60; - if (this._extruder > retractionMinDistance) { + if (this._extruder > minDistance) { this._addGCode({ [MOVE]: 0, [EXTRUDER]: this._extruder.toFixed(3), @@ -121,9 +121,9 @@ export default class { if (!this._isRetracted && enabled) { this._isRetracted = true; - const speed = retractionSpeed * 60; + speed *= 60; - if (this._extruder > retractionMinDistance) { + if (this._extruder > minDistance) { this._addGCode({ [MOVE]: 0, [EXTRUDER]: (this._extruder - retractionAmount).toFixed(3), diff --git a/src/sliceActions/slicesToGCode.js b/src/sliceActions/slicesToGCode.js index 247220a..02cac68 100644 --- a/src/sliceActions/slicesToGCode.js +++ b/src/sliceActions/slicesToGCode.js @@ -1,6 +1,6 @@ import GCode from './helpers/GCode.js'; -const PROFILE_TYPES = ['brim', 'outerLine', 'innerLine', 'fill', 'support']; +const PROFILE_TYPES = ['support', 'innerShell', 'outerShell', 'innerInfill', 'outerInfill', 'brim']; export default function slicesToGCode(slices, settings) { const { @@ -9,7 +9,7 @@ export default function slicesToGCode(slices, settings) { nozzleDiameter, travelSpeed, retraction, - retractionEnabled + travel } = settings; const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI; @@ -19,29 +19,24 @@ export default function slicesToGCode(slices, settings) { const gcode = new GCode(nozzleToFilamentRatio); const defaultProfile = { - travelProfile: { - speed: travelSpeed - }, - retractProfile: { - ...retraction, - enabled: retractionEnabled - } + travelProfile: travel, + retractionProfile: retraction }; - let isBottom = true; + let isFirstLayer = true; for (let layer = 0; layer < slices.length; layer ++) { const slice = slices[layer]; const z = layer * layerHeight + 0.2; if (layer === 1) { gcode.turnFanOn(); - isBottom = false; + isFirstLayer = false; } const profiles = PROFILE_TYPES.reduce((profiles, profileType) => { profiles[profileType] = { ...defaultProfile, - lineProfile: isBottom ? settings.bottom : settings[profileType] + lineProfile: isFirstLayer ? settings.firstLayer : settings[profileType] } return profiles; }, {}); @@ -54,17 +49,17 @@ export default function slicesToGCode(slices, settings) { const part = slice.parts[i]; if (part.shape.closed) { - pathToGCode(gcode, part.outerLine, false, true, profiles.outerLine); + pathToGCode(gcode, part.outerLine, false, true, profiles.outerShell); for (let i = 0; i < part.innerLines.length; i ++) { const innerLine = part.innerLines[i]; - pathToGCode(gcode, innerLine, false, false, z, profiles.innerLine); + pathToGCode(gcode, innerLine, false, false, z, profiles.innerShell); } - pathToGCode(gcode, part.fill, true, false, z, profiles.fill); + pathToGCode(gcode, part.fill, true, false, z, profiles.outerInfill); } else { const retract = !(slice.parts.length === 1 && typeof slice.support === 'undefined'); - pathToGCode(gcode, part.shape, retract, retract, z, profiles.outerLine); + pathToGCode(gcode, part.shape, retract, retract, z, profiles.outerShell); } } @@ -76,7 +71,7 @@ export default function slicesToGCode(slices, settings) { return gcode.getGCode(); } -function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelProfile, retractProfile }) { +function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelProfile, retractionProfile }) { const { closed } = shape; const paths = shape.mapToLower(); @@ -93,7 +88,7 @@ function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelP gcode.moveTo(point.x, point.y, z, travelProfile); if (unRetract) { - gcode.unRetract(retractProfile); + gcode.unRetract(retractionProfile); } } else { gcode.lineTo(point.x, point.y, z, lineProfile); @@ -102,6 +97,6 @@ function pathToGCode(gcode, shape, retract, unRetract, z, { lineProfile, travelP } if (retract) { - gcode.retract(retractProfile); + gcode.retract(retractionProfile); } }