Permalink
Browse files

Split gcoder.Line current_pos tuples into standalone attributes

  • Loading branch information...
iXce committed May 23, 2013
1 parent 5e1a0be commit b27cb371d6a3daf2920e9fd197aaf4ac8936b710
Showing with 9 additions and 5 deletions.
  1. +5 −2 printrun/gcoder.py
  2. +4 −3 printrun/libtatlin/actors.py
View
@@ -30,7 +30,8 @@ class Line(object):
__slots__ = ('x','y','z','e','f','i','j','s',
'raw','split_raw',
'command','is_move',
'relative','relative_e', 'current_pos', 'extruding',
'relative','relative_e',
'current_x', 'current_y', 'current_z', 'extruding',
'gcview_end_vertex')
def __init__(self, l):
@@ -112,7 +113,9 @@ def _preprocess(self, current_x, current_y, current_z):
current_y = line.y or current_y
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)
class GCode(object):
@@ -229,17 +229,18 @@ def load_data(self, model_data, callback=None):
if not gline.is_move:
continue
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
# 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)
vertex_color = self.movement_color(gline)
color_list.append(vertex_color)
prev_pos = gline.current_pos
prev_pos = current_pos
gline.gcview_end_vertex = len(vertex_list)
self.layer_stops.append(len(vertex_list))

0 comments on commit b27cb37

Please sign in to comment.