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"] ...@@ -26,25 +26,11 @@ move_gcodes = ["G0", "G1", "G2", "G3"]
class Line(object): class Line(object):
x = None __slots__ = ('x','y','z','e','f','i','j','s',
y = None 'raw','split_raw',
z = None 'command','is_move',
e = None 'relative','relative_e', 'current_pos', 'extruding',
f = None 'gcview_end_vertex')
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
def __init__(self, l): def __init__(self, l):
self.raw = l self.raw = l
...@@ -52,6 +38,9 @@ class Line(object): ...@@ -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.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 self.is_move = self.command in move_gcodes
def __getattr__(self, name):
return None
def parse_coordinates(self, imperial = False, force = False): def parse_coordinates(self, imperial = False, force = False):
# Not a G-line, we don't want to parse its arguments # Not a G-line, we don't want to parse its arguments
if not force and not self.command[0] == "G": 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