compensate for higher layer height

This commit is contained in:
casperlamboo 2018-01-29 15:15:27 +01:00
parent 0c7f08735f
commit 4482bf1f73
3 changed files with 12 additions and 9 deletions

View File

@ -2,4 +2,4 @@ export const PRECISION = 0.01;
export const VERSION = '0.0.18';
export const LOCAL_STORAGE_KEY = 'PRINTER_SETTINGS';
export const MIN_AREA = 1; // holes smaller as 1mm2 get removed
export const Z_OFFSET = 0.15;
export const Z_OFFSET = 0.3;

View File

@ -11,9 +11,8 @@ export const POSITION_Y = 'Y';
export const POSITION_Z = 'Z';
export default class {
constructor(nozzleToFilamentRatio) {
this._nozzleToFilamentRatio = nozzleToFilamentRatio;
constructor(layerHeight) {
this._nozzleToFilamentRatio = 1;
this._gcode = [`; Generated with Doodle3D Slicer V${VERSION}`];
this._currentValues = {};
this._nozzlePosition = new THREE.Vector2(0, 0);
@ -27,6 +26,12 @@ export default class {
this._gcode.push(command);
}
updateLayerHeight(layerHeight, nozzleDiameter, filamentThickness) {
const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
const lineSurfaceArea = nozzleDiameter * layerHeight;
this._nozzleToFilamentRatio = lineSurfaceArea / filamentSurfaceArea;
}
turnFanOn(fanSpeed) {
this._isFanOn = true;

View File

@ -15,11 +15,8 @@ export default function slicesToGCode(slices, settings) {
combing
} = settings;
const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
const lineSurfaceArea = nozzleDiameter * layerHeight;
const nozzleToFilamentRatio = lineSurfaceArea / filamentSurfaceArea;
const gcode = new GCode(nozzleToFilamentRatio);
const gcode = new GCode();
gcode.updateLayerHeight(Z_OFFSET, nozzleDiameter, filamentThickness)
if (settings.startCode) gcode.addGCode(settings.startCode, settings);
@ -34,6 +31,7 @@ export default function slicesToGCode(slices, settings) {
const z = layer * layerHeight + Z_OFFSET;
if (layer === 1) {
gcode.updateLayerHeight(layerHeight, nozzleDiameter, filamentThickness);
gcode.turnFanOn();
isFirstLayer = false;
}