add z offset

This commit is contained in:
casperlamboo 2017-11-16 22:39:54 +01:00
parent 5bc7d09e8d
commit 2c2bbeda53
3 changed files with 8 additions and 5 deletions

View File

@ -1,3 +1,4 @@
zOffset: 0.3
dimensions:
x: 200
y: 200

View File

@ -2,11 +2,12 @@ import * as THREE from 'three';
export default function calculateLayersIntersections(lines, settings) {
const {
dimensions: { z: dimensionsZ },
layerHeight,
dimensions: { z: dimensionsZ }
zOffset
} = settings;
const numLayers = Math.floor(dimensionsZ / layerHeight);
const numLayers = Math.floor((dimensionsZ - zOffset) / layerHeight);
const layerIntersectionIndexes = Array.from(Array(numLayers)).map(() => []);
const layerIntersectionPoints = Array.from(Array(numLayers)).map(() => []);
@ -24,7 +25,7 @@ export default function calculateLayersIntersections(lines, settings) {
layerIntersectionIndexes[layerIndex].push(lineIndex);
const y = layerIndex * layerHeight;
const y = layerIndex * layerHeight + zOffset;
let x, z;
if (line.start.y === line.end.y) {

View File

@ -12,7 +12,8 @@ export default function slicesToGCode(slices, settings) {
travelSpeed,
retraction,
travel,
combing
combing,
zOffset
} = settings;
const filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
@ -29,7 +30,7 @@ export default function slicesToGCode(slices, settings) {
let isFirstLayer = true;
for (let layer = 0; layer < slices.length; layer ++) {
const slice = slices[layer];
const z = layer * layerHeight;
const z = layer * layerHeight + zOffset;
if (layer === 1) {
gcode.turnFanOn();