use new settings

#25
This commit is contained in:
casperlamboo 2017-07-27 18:33:25 +02:00
parent bcf62c71ec
commit 9805991d9f
5 changed files with 49 additions and 51 deletions

View File

@ -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

View File

@ -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));
}

View File

@ -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);

View File

@ -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),

View File

@ -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);
}
}