Assume the engine sends material amount in mm3 and calculate length based on that

Contributes to Asana issue 38958940640344
This commit is contained in:
Arjen Hiemstra 2015-06-30 11:33:49 +02:00
parent f6f3eba3ff
commit b9fb9385c2

View File

@ -9,6 +9,8 @@ from UM.Resources import Resources
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.Qt.Duration import Duration from UM.Qt.Duration import Duration
import math
## A class for processing and calculating minimum, currrent and maximum print time. ## A class for processing and calculating minimum, currrent and maximum print time.
# #
# This class contains all the logic relating to calculation and slicing for the # This class contains all the logic relating to calculation and slicing for the
@ -146,7 +148,9 @@ class PrintInformation(QObject):
self._current_print_time.setDuration(time) self._current_print_time.setDuration(time)
self.currentPrintTimeChanged.emit() self.currentPrintTimeChanged.emit()
self._material_amount = round(amount / 10) / 100 # Material amount is sent as an amount of mm^3, so calculate length from that
r = self._current_settings.getSettingValueByKey("material_diameter") / 2
self._material_amount = round((amount / (math.pi * r ** 2)) / 1000, 1)
self.materialAmountChanged.emit() self.materialAmountChanged.emit()
if not self._enabled: if not self._enabled: