Commit ad23a280 authored by Guillaume Seguin's avatar Guillaume Seguin

Don't add layers without x/y/z movement to gcview

parent 7c36b6c6
...@@ -277,9 +277,14 @@ class GcodeModel(Model): ...@@ -277,9 +277,14 @@ class GcodeModel(Model):
prev_pos = (0, 0, 0) prev_pos = (0, 0, 0)
for layer_idx, layer in enumerate(model_data.all_layers): for layer_idx, layer in enumerate(model_data.all_layers):
has_movement = False
for gline in layer: for gline in layer:
if not gline.is_move: if not gline.is_move:
continue continue
if gline.x is not None \
or gline.y is not None \
or gline.z is not None:
has_movement = True
current_pos = (gline.current_x, gline.current_y, gline.current_z) current_pos = (gline.current_x, gline.current_y, gline.current_z)
if not gline.extruding: if not gline.extruding:
travel_vertex_list.append(prev_pos) travel_vertex_list.append(prev_pos)
...@@ -301,6 +306,7 @@ class GcodeModel(Model): ...@@ -301,6 +306,7 @@ class GcodeModel(Model):
count_print_vertices.append(len(vertex_list)) count_print_vertices.append(len(vertex_list))
gline.gcview_end_vertex = len(count_print_indices) - 1 gline.gcview_end_vertex = len(count_print_indices) - 1
if has_movement:
self.layer_stops.append(len(count_print_indices) - 1) self.layer_stops.append(len(count_print_indices) - 1)
if callback: if callback:
......
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