From 9d828e3fda5292083584c11535552f906ba4b09e Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Fri, 6 May 2016 19:48:41 +0200 Subject: [PATCH] move down path to code --- src/sliceActions/slicesToGCode.js | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sliceActions/slicesToGCode.js b/src/sliceActions/slicesToGCode.js index 76e0fc4..cf647ee 100644 --- a/src/sliceActions/slicesToGCode.js +++ b/src/sliceActions/slicesToGCode.js @@ -1,32 +1,5 @@ import GCode from '../gcode.js'; -function pathToGCode(gcode, shape, retract, unRetract, layer, type) { - for (let i = 0; i < shape.paths.length; i ++) { - const line = shape.paths[i]; - - const length = shape.closed ? (line.length + 1) : line.length; - for (let i = 0; i < length; i ++) { - const point = line[i % line.length]; - - if (i === 0) { - // TODO - // moveTo should impliment combing - gcode.moveTo(point.X, point.Y, layer); - - if (unRetract) { - gcode.unRetract(); - } - } else { - gcode.lineTo(point.X, point.Y, layer, type); - } - } - } - - if (retract) { - gcode.retract(); - } -} - export default function slicesToGCode(slices, settings) { const gcode = new GCode().setSettings(settings); @@ -67,3 +40,30 @@ export default function slicesToGCode(slices, settings) { return gcode.getGCode(); } + +function pathToGCode(gcode, shape, retract, unRetract, layer, type) { + for (let i = 0; i < shape.paths.length; i ++) { + const line = shape.paths[i]; + + const length = shape.closed ? (line.length + 1) : line.length; + for (let i = 0; i < length; i ++) { + const point = line[i % line.length]; + + if (i === 0) { + // TODO + // moveTo should impliment combing + gcode.moveTo(point.X, point.Y, layer); + + if (unRetract) { + gcode.unRetract(); + } + } else { + gcode.lineTo(point.X, point.Y, layer, type); + } + } + } + + if (retract) { + gcode.retract(); + } +}