chiark / gitweb /
Updated print window with statistics about the print. Filament used, and estimated...
[cura.git] / Cura / util / gcodeInterpreter.py
index 06ebd5ac6d795fc4e708ab1a171070c65dea8105..3570d49e99d8e7b7979bb86ce982cd87d4d852ad 100644 (file)
@@ -7,6 +7,7 @@ import re
 import os
 
 from util import util3d
+from util import profile
 
 class gcodePath():
        def __init__(self, newType, pathType, startPoint):
@@ -31,6 +32,12 @@ class gcode():
        def loadList(self, l):
                self._load(l)
        
+       def calculateWeight(self):
+               #Calculates the weight of the filament in kg
+               radius = float(profile.getProfileSetting('filament_diameter')) / 2
+               volumeM3 = (self.extrusionAmount * (math.pi * radius * radius)) / (1000*1000*1000)
+               return volumeM3 * float(profile.getPreference('filament_density'))
+       
        def _load(self, gcodeFile):
                filePos = 0
                pos = util3d.Vector3()