From ed0129df1e65574e4d475166abb321721fce8ae5 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 19 Jan 2015 03:33:04 -0300 Subject: [PATCH] sfc/slicer.py: fix generation of intermediate layers --- sfc/slicer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sfc/slicer.py b/sfc/slicer.py index 4b21d27..8a48223 100755 --- a/sfc/slicer.py +++ b/sfc/slicer.py @@ -213,13 +213,13 @@ if height is not None and height < 0 and z_levels[-1] > height: for next_z in z_levels: wires = shape.slice(Base.Vector(0, 0, 1), next_z + epsilon) - if z_step is None or last_z is None or last_z + z_step >= next_z: + if z_step is None or last_z is None or last_z - z_step <= next_z: dump_level(wires, next_z + z_off) else: - d = next_z - last_z - n = (d // z_step) + 1 + d = last_z - next_z + n = int(d // z_step) + 1 for i in range(0, n): - dump_level(wires, last_z + (i + 1) * (d / n) + z_off) + dump_level(wires, last_z - (i + 1) * (d / n) + z_off) last_z = next_z #