Show print time, filemant used and cost estimate after slicing.
parent
2e6f887499
commit
632a447575
|
@ -176,14 +176,9 @@ class printWindow(wx.Frame):
|
|||
status = ""
|
||||
if self.gcode != None:
|
||||
status += "Filament: %.2fm %.2fg\n" % (self.gcode.extrusionAmount / 1000, self.gcode.calculateWeight() * 1000)
|
||||
cost_kg = float(profile.getPreference('filament_cost_kg'))
|
||||
cost_meter = float(profile.getPreference('filament_cost_meter'))
|
||||
if cost_kg > 0.0 and cost_meter > 0.0:
|
||||
status += "Filament cost: %.2f / %.2f\n" % (self.gcode.calculateWeight() * cost_kg, self.gcode.extrusionAmount / 1000 * cost_meter)
|
||||
elif cost_kg > 0.0:
|
||||
status += "Filament cost: %.2f\n" % (self.gcode.calculateWeight() * cost_kg)
|
||||
elif cost_meter > 0.0:
|
||||
status += "Filament cost: %.2f\n" % (self.gcode.extrusionAmount / 1000 * cost_meter)
|
||||
cost = self.gcode.calculateCost()
|
||||
if cost != False:
|
||||
status += "Filament cost: %s\n" % (cost)
|
||||
status += "Print time: %02d:%02d\n" % (int(self.gcode.totalMoveTimeMinute / 60), int(self.gcode.totalMoveTimeMinute % 60))
|
||||
if self.printIdx == None:
|
||||
self.progress.SetValue(0)
|
||||
|
|
|
@ -6,6 +6,7 @@ import wx, sys, os, math, threading, subprocess, time
|
|||
from util import profile
|
||||
from util import sliceRun
|
||||
from util import exporer
|
||||
from util import gcodeInterpreter
|
||||
|
||||
class sliceProgessPanel(wx.Panel):
|
||||
def __init__(self, mainWindow, parent, filelist):
|
||||
|
@ -100,7 +101,12 @@ class sliceProgessPanel(wx.Panel):
|
|||
self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)
|
||||
self.sizer.Add(self.logButton, 0)
|
||||
if result.returnCode == 0:
|
||||
self.statusText.SetLabel("Ready.")
|
||||
status = "Ready: Filament: %.2fm %.2fg" % (result.gcode.extrusionAmount / 1000, result.gcode.calculateWeight() * 1000)
|
||||
status += " Print time: %02d:%02d\n" % (int(result.gcode.totalMoveTimeMinute / 60), int(result.gcode.totalMoveTimeMinute % 60))
|
||||
cost = result.gcode.calculateCost()
|
||||
if cost != False:
|
||||
status += "Cost: %s\n" % (cost)
|
||||
self.statusText.SetLabel(status)
|
||||
if exporer.hasExporer():
|
||||
self.openFileLocationButton = wx.Button(self, -1, "Open file location")
|
||||
self.Bind(wx.EVT_BUTTON, self.OnOpenFileLocation, self.openFileLocationButton)
|
||||
|
@ -169,6 +175,8 @@ class WorkerThread(threading.Thread):
|
|||
if self.fileIdx == len(self.cmdList):
|
||||
if len(self.filelist) > 1:
|
||||
self._stitchMultiExtruder()
|
||||
self.gcode = gcodeInterpreter.gcode()
|
||||
self.gcode.load(self.filelist[0][:self.filelist[0].rfind('.')]+'_export.gcode')
|
||||
wx.CallAfter(self.notifyWindow.OnSliceDone, self)
|
||||
else:
|
||||
self.run()
|
||||
|
|
|
@ -38,6 +38,17 @@ class gcode():
|
|||
volumeM3 = (self.extrusionAmount * (math.pi * radius * radius)) / (1000*1000*1000)
|
||||
return volumeM3 * float(profile.getPreference('filament_density'))
|
||||
|
||||
def calculateCost(self):
|
||||
cost_kg = float(profile.getPreference('filament_cost_kg'))
|
||||
cost_meter = float(profile.getPreference('filament_cost_meter'))
|
||||
if cost_kg > 0.0 and cost_meter > 0.0:
|
||||
return "%.2f / %.2f" % (self.calculateWeight() * cost_kg, self.extrusionAmount / 1000 * cost_meter)
|
||||
elif cost_kg > 0.0:
|
||||
return "%.2f" % (self.calculateWeight() * cost_kg)
|
||||
elif cost_meter > 0.0:
|
||||
return "%.2f" % (self.extrusionAmount / 1000 * cost_meter)
|
||||
return False
|
||||
|
||||
def _load(self, gcodeFile):
|
||||
filePos = 0
|
||||
pos = util3d.Vector3()
|
||||
|
@ -200,8 +211,8 @@ class gcode():
|
|||
self.layerList.append(currentLayer)
|
||||
self.extrusionAmount = maxExtrusion
|
||||
self.totalMoveTimeMinute = totalMoveTimeMinute
|
||||
print "Extruded a total of: %d mm of filament" % (self.extrusionAmount)
|
||||
print "Estimated print duration: %.2f minutes" % (self.totalMoveTimeMinute)
|
||||
#print "Extruded a total of: %d mm of filament" % (self.extrusionAmount)
|
||||
#print "Estimated print duration: %.2f minutes" % (self.totalMoveTimeMinute)
|
||||
|
||||
def getCodeInt(self, line, code):
|
||||
if code not in self.regMatch:
|
||||
|
|
Loading…
Reference in New Issue