Commit b27cb371 authored by Guillaume Seguin's avatar Guillaume Seguin

Split gcoder.Line current_pos tuples into standalone attributes

parent 5e1a0be4
...@@ -30,7 +30,8 @@ class Line(object): ...@@ -30,7 +30,8 @@ class Line(object):
__slots__ = ('x','y','z','e','f','i','j','s', __slots__ = ('x','y','z','e','f','i','j','s',
'raw','split_raw', 'raw','split_raw',
'command','is_move', 'command','is_move',
'relative','relative_e', 'current_pos', 'extruding', 'relative','relative_e',
'current_x', 'current_y', 'current_z', 'extruding',
'gcview_end_vertex') 'gcview_end_vertex')
def __init__(self, l): def __init__(self, l):
...@@ -112,7 +113,9 @@ class Layer(object): ...@@ -112,7 +113,9 @@ class Layer(object):
current_y = line.y or current_y current_y = line.y or current_y
current_z = line.z or current_z current_z = line.z or current_z
line.current_pos = (current_x, current_y, current_z) line.current_x = current_x
line.current_y = current_y
line.current_z = current_z
return (current_x, current_y, current_z), (xmin, xmax), (ymin, ymax), (zmin, zmax) return (current_x, current_y, current_z), (xmin, xmax), (ymin, ymax), (zmin, zmax)
class GCode(object): class GCode(object):
......
...@@ -229,17 +229,18 @@ class GcodeModel(Model): ...@@ -229,17 +229,18 @@ class GcodeModel(Model):
if not gline.is_move: if not gline.is_move:
continue continue
vertex_list.append(prev_pos) vertex_list.append(prev_pos)
vertex_list.append(gline.current_pos) current_pos = (gline.current_x, gline.current_y, gline.current_z)
vertex_list.append(current_pos)
arrow = self.arrow arrow = self.arrow
# position the arrow with respect to movement # position the arrow with respect to movement
arrow = vector.rotate(arrow, movement_angle(prev_pos, gline.current_pos), 0.0, 0.0, 1.0) arrow = vector.rotate(arrow, movement_angle(prev_pos, current_pos), 0.0, 0.0, 1.0)
arrow_list.extend(arrow) arrow_list.extend(arrow)
vertex_color = self.movement_color(gline) vertex_color = self.movement_color(gline)
color_list.append(vertex_color) color_list.append(vertex_color)
prev_pos = gline.current_pos prev_pos = current_pos
gline.gcview_end_vertex = len(vertex_list) gline.gcview_end_vertex = len(vertex_list)
self.layer_stops.append(len(vertex_list)) self.layer_stops.append(len(vertex_list))
......
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