Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Split gcoder.Line current_pos tuples into standalone attributes
  • Loading branch information
iXce committed May 23, 2013
1 parent 5e1a0be commit b27cb37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions printrun/gcoder.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions printrun/libtatlin/actors.py
Expand Up @@ -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))
Expand Down

0 comments on commit b27cb37

Please sign in to comment.