use mapToLower to get path data

This commit is contained in:
casperlamboo 2016-08-27 10:01:50 +02:00 committed by Simon Voordouw
parent 4c4cd96ddf
commit 29e46217f8

View File

@ -44,23 +44,26 @@ export default function slicesToGCode(slices, settings) {
} }
function pathToGCode(gcode, shape, retract, unRetract, layer, type) { function pathToGCode(gcode, shape, retract, unRetract, layer, type) {
for (let i = 0; i < shape.paths.length; i ++) { const { closed } = shape;
const line = shape.paths[i]; const paths = shape.mapToLower();
const length = shape.closed ? (line.length + 1) : line.length; for (let i = 0; i < paths.length; i ++) {
const line = paths[i];
const length = closed ? (line.length + 1) : line.length;
for (let i = 0; i < length; i ++) { for (let i = 0; i < length; i ++) {
const point = line[i % line.length]; const point = line[i % line.length];
if (i === 0) { if (i === 0) {
// TODO // TODO
// moveTo should impliment combing // moveTo should impliment combing
gcode.moveTo(point.X, point.Y, layer); gcode.moveTo(point.x, point.y, layer);
if (unRetract) { if (unRetract) {
gcode.unRetract(); gcode.unRetract();
} }
} else { } else {
gcode.lineTo(point.X, point.Y, layer, type); gcode.lineTo(point.x, point.y, layer, type);
} }
} }
} }