Commit 2a6eec73 authored by Guillaume Seguin's avatar Guillaume Seguin

Heavy memory optimization of gcoder.Line by hardcoding which fields we use

parent 86bf8ca7
......@@ -26,25 +26,11 @@ move_gcodes = ["G0", "G1", "G2", "G3"]
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
......@@ -52,6 +38,9 @@ class Line(object):
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":
......
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