chiark / gitweb /
Fix the multiply feature (oops). Added total extrusion calculation to GCode interpreter
authordaid <daid303@gmail.com>
Fri, 16 Mar 2012 12:27:04 +0000 (13:27 +0100)
committerdaid <daid303@gmail.com>
Fri, 16 Mar 2012 12:27:04 +0000 (13:27 +0100)
SkeinPyPy_NewUI/fabmetheus_utilities/settings.py
SkeinPyPy_NewUI/newui/gcodeInterpreter.py

index f9729162e9ee29063b0818045e6706d7b2b08d17..41c4d460bc3fd191628e639b505e5eaa8090aa2c 100644 (file)
@@ -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': {
index cb89cf14680f879f3ac9c89a20a1631cfc66add2..ea9ed5abc7ef140aa419e61d596df6a706cbcd55 100644 (file)
@@ -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)