From: daid Date: Fri, 16 Mar 2012 12:27:04 +0000 (+0100) Subject: Fix the multiply feature (oops). Added total extrusion calculation to GCode interpreter X-Git-Tag: RC1~78 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6a5cab63d7e0b8be3384ba35c1237286c288f9a7;p=cura.git Fix the multiply feature (oops). Added total extrusion calculation to GCode interpreter --- diff --git a/SkeinPyPy_NewUI/fabmetheus_utilities/settings.py b/SkeinPyPy_NewUI/fabmetheus_utilities/settings.py index f9729162..41c4d460 100644 --- a/SkeinPyPy_NewUI/fabmetheus_utilities/settings.py +++ b/SkeinPyPy_NewUI/fabmetheus_utilities/settings.py @@ -154,8 +154,8 @@ def getSkeinPyPyProfileInformation(): 'Activate_Multiply': "True", 'Center_X_mm': storedSetting("machine_center_x"), 'Center_Y_mm': storedSetting("machine_center_y"), - 'Number_of_Columns_integer': storedSetting('model_multiply_x', '1'), - 'Number_of_Rows_integer': storedSetting('model_multiply_y', '1'), + 'Number_of_Columns_integer': storedSetting('model_multiply_x'), + 'Number_of_Rows_integer': storedSetting('model_multiply_y'), 'Reverse_Sequence_every_Odd_Layer': DEFSET, 'Separation_over_Perimeter_Width_ratio': DEFSET, },'speed': { diff --git a/SkeinPyPy_NewUI/newui/gcodeInterpreter.py b/SkeinPyPy_NewUI/newui/gcodeInterpreter.py index cb89cf14..ea9ed5ab 100644 --- a/SkeinPyPy_NewUI/newui/gcodeInterpreter.py +++ b/SkeinPyPy_NewUI/newui/gcodeInterpreter.py @@ -10,7 +10,8 @@ class gcode(): f = open(filename, 'r') pos = util3d.Vector3() posOffset = util3d.Vector3() - currentE = 0 + currentE = 0.0 + totalExtrusion = 0.0 pathList = [] scale = 1.0 posAbs = True @@ -52,18 +53,26 @@ class gcode(): layerNr += 1 if f is not None: feedRate = f - newPoint = pos.copy() moveType = 'move' if e is not None: - if e > currentE: - moveType = 'extrude' - if e < currentE: - moveType = 'retract' - currentE = e + if posAbs: + if e > currentE: + moveType = 'extrude' + if e < currentE: + moveType = 'retract' + totalExtrusion += e - currentE + currentE = e + else: + if e > 0: + moveType = 'extrude' + if e < 0: + moveType = 'retract' + totalExtrusion += e + currentE += e if currentPath['type'] != moveType or currentPath['pathType'] != pathType: pathList.append(currentPath) currentPath = {'type': moveType, 'pathType': pathType, 'list': [currentPath['list'][-1]], 'layerNr': layerNr} - currentPath['list'].append(newPoint) + currentPath['list'].append(pos.copy()) elif G == 20: #Units are inches scale = 25.4 elif G == 21: #Units are mm @@ -125,6 +134,8 @@ class gcode(): print "Unknown M code:" + str(M) self.layerCount = layerNr self.pathList = pathList + self.totalExtrusion = totalExtrusion + print "Extruded a total of: %d mm of filament" % (self.totalExtrusion) def getCodeInt(self, str, id): m = re.search(id + '([^\s]+)', str)