From 2304560a13b94d75bd47c5ddaa2e7851d524a7c1 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 25 Jul 2017 14:34:12 +0200 Subject: [PATCH 1/6] Revert "Fix generate inner lines" This reverts commit b62e3b5cb8a95ae0e0093be0f56190c26f626efc. --- src/sliceActions/generateInnerLines.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sliceActions/generateInnerLines.js b/src/sliceActions/generateInnerLines.js index 046369c..a829a43 100644 --- a/src/sliceActions/generateInnerLines.js +++ b/src/sliceActions/generateInnerLines.js @@ -32,7 +32,7 @@ export default function generateInnerLines(slices, settings) { if (outerLine.paths.length > 0) { part.outerLine.join(outerLine); - for (let shell = 1; shell <= shells; shell += 1) { + for (let shell = 1; shell < shells; shell += 1) { const offset = shell * nozzleDiameter; const innerLine = outerLine.offset(-offset, offsetOptions); From 4304f7373da574c1a99a48fd0a0b6087e13a55cf Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Tue, 25 Jul 2017 14:36:26 +0200 Subject: [PATCH 2/6] add comment @peteruithoven I was wrong about the less then :( --- src/sliceActions/generateInnerLines.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sliceActions/generateInnerLines.js b/src/sliceActions/generateInnerLines.js index a829a43..cfab81e 100644 --- a/src/sliceActions/generateInnerLines.js +++ b/src/sliceActions/generateInnerLines.js @@ -32,6 +32,7 @@ export default function generateInnerLines(slices, settings) { if (outerLine.paths.length > 0) { part.outerLine.join(outerLine); + // start with 1 because outerLine is the 1st (0) shell for (let shell = 1; shell < shells; shell += 1) { const offset = shell * nozzleDiameter; From ccc88bdb77322ff01bc3ff8fcc7bc7381eca44d8 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 27 Jul 2017 10:35:30 +0200 Subject: [PATCH 3/6] pre calculate bounding boxes --- src/sliceActions/optimizePaths.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/sliceActions/optimizePaths.js b/src/sliceActions/optimizePaths.js index 6cc861c..5c6e718 100644 --- a/src/sliceActions/optimizePaths.js +++ b/src/sliceActions/optimizePaths.js @@ -13,6 +13,15 @@ export default function optimizePaths(slices, settings) { } const parts = []; + const boundingBoxes = new WeakMap(); + for (let i = 0; i < slice.parts.length; i ++) { + const part = slice.parts[i]; + + const shape = part.shape.closed ? part.outerLine : part.shape; + const bounds = shape.shapeBounds(); + + boundingBoxes.set(part, bounds); + } while (slice.parts.length > 0) { let closestDistance = Infinity; @@ -20,16 +29,14 @@ export default function optimizePaths(slices, settings) { for (let i = 0; i < slice.parts.length; i ++) { const part = slice.parts[i]; + const bounds = boundingBoxes.get(part); - const shape = part.shape.closed ? part.outerLine : part.shape; - const bounds = shape.shapeBounds(); + const topDistance = bounds.top - start.y; + const bottomDistance = start.y - bounds.bottom; + const leftDistance = bounds.left - start.x; + const rightDistance = start.x - bounds.right; - const top = bounds.top - start.y; - const bottom = start.y - bounds.bottom; - const left = bounds.left - start.x; - const right = start.x - bounds.right; - - const distance = Math.max(top, bottom, left, right); + const distance = Math.max(topDistance, bottomDistance, leftDistance, rightDistance); if (distance < closestDistance) { closestDistance = distance; From bcfbe99579fc889a32f8909d6ebfb928bd3714b3 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 27 Jul 2017 12:42:14 +0200 Subject: [PATCH 4/6] remove overlap setting --- src/settings/default.yml | 1 - src/sliceActions/generateInfills.js | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/settings/default.yml b/src/settings/default.yml index 77db94c..0fd05a0 100644 --- a/src/settings/default.yml +++ b/src/settings/default.yml @@ -35,7 +35,6 @@ innerLine: fill: flowRate: 1.0 speed: 50.0 - overlap: 0.0 gridSize: 5.0 brim: flowRate: 1.0 diff --git a/src/sliceActions/generateInfills.js b/src/sliceActions/generateInfills.js index 40ed2a6..31c4ec7 100644 --- a/src/sliceActions/generateInfills.js +++ b/src/sliceActions/generateInfills.js @@ -8,8 +8,7 @@ export default function generateInfills(slices, settings) { fill: { gridSize: fillGridSize }, bottom: { thickness: bottomThickness }, top: { thickness: topThickness }, - nozzleDiameter, - fill: { overlap: infillOverlap } + nozzleDiameter } = settings; fillGridSize /= PRECISION; @@ -47,13 +46,7 @@ export default function generateInfills(slices, settings) { let lowFillArea; let highFillArea; if (surroundingLayer) { - highFillArea = fillArea.difference(surroundingLayer); - - if (infillOverlap > 0) { - highFillArea = highFillArea.offset(infillOverlap); - } - - highFillArea = highFillArea.intersect(fillArea); + highFillArea = fillArea.difference(surroundingLayer).intersect(fillArea); lowFillArea = fillArea.difference(highFillArea); } else { highFillArea = fillArea; From 34f6a91db9bfb32ee02d11e1060814ed4dae1d1e Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 27 Jul 2017 14:48:15 +0200 Subject: [PATCH 5/6] remove unnecessary check --- src/sliceActions/helpers/GCode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sliceActions/helpers/GCode.js b/src/sliceActions/helpers/GCode.js index 18f0261..efadde9 100644 --- a/src/sliceActions/helpers/GCode.js +++ b/src/sliceActions/helpers/GCode.js @@ -164,7 +164,7 @@ export default class { const speed = retractionSpeed * 60; - if (this._extruder > retractionMinDistance && retractionEnabled) { + if (this._extruder > retractionMinDistance) { this._addGCode({ [MOVE]: 0, [EXTRUDER]: (this._extruder - retractionAmount).toFixed(3), From b8b67e664b1a78bc7d023f627dd3d103ad60c1b9 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Thu, 27 Jul 2017 16:47:36 +0200 Subject: [PATCH 6/6] Fix extruder calculation --- src/sliceActions/helpers/GCode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sliceActions/helpers/GCode.js b/src/sliceActions/helpers/GCode.js index efadde9..48bc6dc 100644 --- a/src/sliceActions/helpers/GCode.js +++ b/src/sliceActions/helpers/GCode.js @@ -107,7 +107,7 @@ export default class { const lineLength = this._nozzlePosition.distanceTo(newNozzlePosition); const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI; - this._extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate; + this._extruder += lineLength * ((nozzleDiameter * layerHeight) / filamentSurfaceArea) * flowRate; this._addGCode({ [MOVE]: 1,