fix sparse fill for certain values. update n2 profile

This commit is contained in:
Stewart Allen 2017-12-17 14:14:42 -05:00
commit cada414f21
3 changed files with 44 additions and 37 deletions

View file

@ -74,6 +74,7 @@ var gs_kiri_print = exports;
min: { x:Infinity, y:Infinity, z:Infinity}
},
seq = [],
abs = true,
move = false,
E0G0 = false,
G0 = function() {
@ -92,15 +93,23 @@ var gs_kiri_print = exports;
E: 0.0
},
off = {
x: offset ? offset.x || 0 : 0,
y: offset ? offset.y || 0 : 0,
z: offset ? offset.z || 0 : 0
X: offset ? offset.x || 0 : 0,
Y: offset ? offset.y || 0 : 0,
Z: offset ? offset.z || 0 : 0
};
lines.forEach(function(line) {
line = line.split(";")[0].split(" ");
if (line.length < 2) return;
switch (line.shift()) {
case 'G90':
// absolute positioning
abs = true;
break;
case 'G91':
// relative positioning
abs = false;
break;
case 'G0':
G0();
case 'G1':
@ -120,7 +129,7 @@ var gs_kiri_print = exports;
}
addOutput(
seq,
{x:pos.X + off.x, y:pos.Y + off.y, z:pos.Z + off.z},
{x:pos.X + off.X, y:pos.Y + off.Y, z:pos.Z + off.Z},
!move,
pos.F
);

View file

@ -1122,6 +1122,7 @@ var gs_kiri_slice = exports;
bounds = target.bounds(),
even = true,
evenZ = target.zIndex() % 2 === 0,
maxy = bounds.max.y + (vhlen + anylen * 2),
x, y;
if (full || evenZ) {
@ -1131,7 +1132,7 @@ var gs_kiri_slice = exports;
if (!even && x > bounds.max.x + anxlen + spacing) break;
y = bounds.min.y;
target.newline();
while (y < bounds.max.y) {
while (y <= maxy) {
target.emit(x,y);
y += vhlen;
target.emit(x,y);