Commit 1921d2ab authored by Guillaume Seguin's avatar Guillaume Seguin

Group gcodes which are closer than 0.01mm in Z

This is aimed at Slic3r's spiral vase mode which continuously lifts Z.
parent 727f9f0a
...@@ -270,10 +270,14 @@ class GCode(object): ...@@ -270,10 +270,14 @@ class GCode(object):
cur_z = line.z cur_z = line.z
if cur_z != prev_z: if cur_z != prev_z:
if prev_z is not None:
base_z = (prev_z - (prev_z % 0.1)) if abs(cur_z - prev_z) < 0.01 else prev_z
else:
base_z = None
all_layers.append(Layer(cur_lines)) all_layers.append(Layer(cur_lines))
old_lines = layers.get(prev_z, []) old_lines = layers.get(base_z, [])
old_lines += cur_lines old_lines += cur_lines
layers[prev_z] = old_lines layers[base_z] = old_lines
cur_lines = [] cur_lines = []
layer_id += 1 layer_id += 1
layer_line = 0 layer_line = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment