mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 23:15:52 +08:00
Merge pull request #1586 from fieldOfView/fix_radius0
Fix crash when editing material diameter
This commit is contained in:
parent
6bf3d084b9
commit
3a255b341f
@ -123,7 +123,7 @@ class PrintInformation(QObject):
|
|||||||
|
|
||||||
def _calculateInformation(self):
|
def _calculateInformation(self):
|
||||||
# Material amount is sent as an amount of mm^3, so calculate length from that
|
# Material amount is sent as an amount of mm^3, so calculate length from that
|
||||||
r = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2
|
radius = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2
|
||||||
self._material_lengths = []
|
self._material_lengths = []
|
||||||
self._material_weights = []
|
self._material_weights = []
|
||||||
self._material_costs = []
|
self._material_costs = []
|
||||||
@ -158,8 +158,12 @@ class PrintInformation(QObject):
|
|||||||
else:
|
else:
|
||||||
cost = 0
|
cost = 0
|
||||||
|
|
||||||
|
if radius != 0:
|
||||||
|
length = round((amount / (math.pi * radius ** 2)) / 1000, 2)
|
||||||
|
else:
|
||||||
|
length = 0
|
||||||
self._material_weights.append(weight)
|
self._material_weights.append(weight)
|
||||||
self._material_lengths.append(round((amount / (math.pi * r ** 2)) / 1000, 2))
|
self._material_lengths.append(length)
|
||||||
self._material_costs.append(cost)
|
self._material_costs.append(cost)
|
||||||
|
|
||||||
self.materialLengthsChanged.emit()
|
self.materialLengthsChanged.emit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user