Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo committed Jul 27, 2017
2 parents ee83f69 + b8b67e6 commit eb6747a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/settings/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ innerLine:
fill:
flowRate: 1.0
speed: 50.0
overlap: 0.0
gridSize: 5.0
brim:
flowRate: 1.0
Expand Down
11 changes: 2 additions & 9 deletions src/sliceActions/generateInfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/sliceActions/generateInnerLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default function generateInnerLines(slices, settings) {
if (outerLine.paths.length > 0) {
part.outerLine.join(outerLine);

for (let shell = 1; shell <= shells; shell += 1) {
// start with 1 because outerLine is the 1st (0) shell
for (let shell = 1; shell < shells; shell += 1) {
const offset = shell * nozzleDiameter;

const innerLine = outerLine.offset(-offset, offsetOptions);
Expand Down
4 changes: 2 additions & 2 deletions src/sliceActions/helpers/GCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
23 changes: 15 additions & 8 deletions src/sliceActions/optimizePaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,30 @@ 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;
let closestPart;

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 top = bounds.top - start.y;
const bottom = start.y - bounds.bottom;
const left = bounds.left - start.x;
const right = start.x - bounds.right;
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 distance = Math.max(top, bottom, left, right);
const distance = Math.max(topDistance, bottomDistance, leftDistance, rightDistance);

if (distance < closestDistance) {
closestDistance = distance;
Expand Down

0 comments on commit eb6747a

Please sign in to comment.