From 821c0c9abb6267c967f5a4e0b96cd936228758df Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Wed, 7 Aug 2013 11:08:08 -0400 Subject: [PATCH] Don't store layers or path points to save memory --- octoprint/util/gcodeInterpreter.py | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/octoprint/util/gcodeInterpreter.py b/octoprint/util/gcodeInterpreter.py index cb36f127..4a52e0fd 100644 --- a/octoprint/util/gcodeInterpreter.py +++ b/octoprint/util/gcodeInterpreter.py @@ -105,13 +105,13 @@ class gcode(object): moveType = 'move' layerThickness = 0.1 pathType = 'CUSTOM' - currentLayer = [] + #currentLayer = [] unknownGcodes = {} unknownMcodes = {} - currentPath = gcodePath('move', pathType, layerThickness, pos) - currentPath['extruder'] = currentExtruder + #currentPath = gcodePath('move', pathType, layerThickness, pos) + #currentPath['extruder'] = currentExtruder - currentLayer.append(currentPath) + #currentLayer.append(currentPath) for line in gcodeFile: if self._abort: raise AnalysisAborted() @@ -136,14 +136,14 @@ class gcode(object): self._filamentDiameter = float(comment.split("=", 1)[1].strip()) elif comment.startswith('TYPE:'): pathType = comment[5:] - elif comment.startswith('LAYER:'): - currentPath = gcodePath(moveType, pathType, layerThickness, currentPath['points'][-1]) - currentPath['extruder'] = currentExtruder + #elif comment.startswith('LAYER:'): + #currentPath = gcodePath(moveType, pathType, layerThickness, currentPath['points'][-1]) + #currentPath['extruder'] = currentExtruder #for path in currentLayer: # path['points'] = numpy.array(path['points'], numpy.float32) # path['extrusion'] = numpy.array(path['extrusion'], numpy.float32) - self.layerList.append(currentLayer) - currentLayer = [currentPath] + #self.layerList.append(currentLayer) + #currentLayer = [currentPath] elif comment.startswith("CURA_PROFILE_STRING"): curaOptions = self._parseCuraProfileString(comment) if "filament_diameter" in curaOptions: @@ -211,13 +211,13 @@ class gcode(object): if oldPos[2] > pos[2] and abs(oldPos[2] - pos[2]) > 5.0 and pos[2] < 1.0: oldPos[2] = 0.0 layerThickness = abs(oldPos[2] - pos[2]) - if currentPath['type'] != moveType or currentPath['pathType'] != pathType: - currentPath = gcodePath(moveType, pathType, layerThickness, currentPath['points'][-1]) - currentPath['extruder'] = currentExtruder - currentLayer.append(currentPath) + #if currentPath['type'] != moveType or currentPath['pathType'] != pathType: + # currentPath = gcodePath(moveType, pathType, layerThickness, currentPath['points'][-1]) + # currentPath['extruder'] = currentExtruder + # currentLayer.append(currentPath) - currentPath['points'].append(pos) - currentPath['extrusion'].append(e * extrudeAmountMultiply) + #currentPath['points'].append(pos) + #currentPath['extrusion'].append(e * extrudeAmountMultiply) elif G == 4: #Delay S = getCodeFloat(line, 'S') if S is not None: @@ -324,7 +324,7 @@ class gcode(object): #for path in currentLayer: # path['points'] = numpy.array(path['points'], numpy.float32) # path['extrusion'] = numpy.array(path['extrusion'], numpy.float32) - self.layerList.append(currentLayer) + #self.layerList.append(currentLayer) if self.progressCallback is not None: self.progressCallback(100.0) self.extrusionAmount = maxExtrusion