From 4cc43e1661f37cdfdd6c059228e13701763f89ee Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Tue, 20 Jan 2015 03:19:22 -0300 Subject: [PATCH] sfc/slicer.py: when flipping, also flip Z positions used for selecting levels This led to toolpaths full of strange yet almost imperceptible errors along the Z axis, just on the edge of what could be explained by machining tolerances. --- sfc/slicer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sfc/slicer.py b/sfc/slicer.py index 8a48223..4c2210c 100755 --- a/sfc/slicer.py +++ b/sfc/slicer.py @@ -150,7 +150,10 @@ max_nz = 0 inclined = 0 for facet in mesh.Facets: if abs(facet.Normal.z) >= 1 - epsilon: - z_raw[facet.Points[0][2]] = 1 + z = facet.Points[0][2] + if flip: + z = bb.ZMax - z + bb.ZMin + z_raw[z] = 1 else: nz = abs(facet.Normal.z) if nz > epsilon: