Permalink
Browse files

Heavy memory optimization of gcoder.Line by hardcoding which fields w…

…e use
  • Loading branch information...
iXce committed May 23, 2013
1 parent 86bf8ca commit 2a6eec73e17807e6dda11fb870b99040b987eb65
Showing with 8 additions and 19 deletions.
  1. +8 −19 printrun/gcoder.py
View
@@ -26,32 +26,21 @@
class Line(object):
x = None
y = None
z = None
e = None
f = None
i = None
j = None
s = None
raw = None
split_raw = None
command = None
is_move = False
relative = False
relative_e = False
current_pos = None
extruding = None
__slots__ = ('x','y','z','e','f','i','j','s',
'raw','split_raw',
'command','is_move',
'relative','relative_e', 'current_pos', 'extruding',
'gcview_end_vertex')
def __init__(self, l):
self.raw = l
self.split_raw = gcode_exp.findall(self.raw.lower())
self.command = self.split_raw[0].upper() if not self.split_raw[0].startswith("n") else self.split_raw[1].upper()
self.is_move = self.command in move_gcodes
def __getattr__(self, name):
return None
def parse_coordinates(self, imperial = False, force = False):
# Not a G-line, we don't want to parse its arguments
if not force and not self.command[0] == "G":

0 comments on commit 2a6eec7

Please sign in to comment.