mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
CURA-4525 fixed material info per build plate, bugfix arrange on load
This commit is contained in:
parent
4a893c048e
commit
be6561b575
5 changed files with 21 additions and 16 deletions
|
@ -1428,7 +1428,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
self.fileLoaded.emit(filename)
|
self.fileLoaded.emit(filename)
|
||||||
arrange_objects_on_load = Preferences.getInstance().getValue("cura/arrange_objects_on_load")
|
arrange_objects_on_load = Preferences.getInstance().getValue("cura/arrange_objects_on_load")
|
||||||
target_build_plate = self.activeBuildPlate if arrange_objects_on_load else -1
|
target_build_plate = self.getBuildPlateModel().activeBuildPlate if arrange_objects_on_load else -1
|
||||||
|
|
||||||
for original_node in nodes:
|
for original_node in nodes:
|
||||||
node = CuraSceneNode() # We want our own CuraSceneNode
|
node = CuraSceneNode() # We want our own CuraSceneNode
|
||||||
|
|
|
@ -165,13 +165,16 @@ class PrintInformation(QObject):
|
||||||
def materialNames(self):
|
def materialNames(self):
|
||||||
return self._material_names[self._active_build_plate]
|
return self._material_names[self._active_build_plate]
|
||||||
|
|
||||||
|
def printTimes(self):
|
||||||
|
return self._print_time_message_values[self._active_build_plate]
|
||||||
|
|
||||||
def _onPrintDurationMessage(self, build_plate_number, print_time, material_amounts):
|
def _onPrintDurationMessage(self, build_plate_number, print_time, material_amounts):
|
||||||
Logger.log("d", " ### print duration message for build plate %s", build_plate_number)
|
Logger.log("d", " ### print duration message for build plate %s", build_plate_number)
|
||||||
self._updateTotalPrintTimePerFeature(build_plate_number, print_time)
|
self._updateTotalPrintTimePerFeature(build_plate_number, print_time)
|
||||||
self.currentPrintTimeChanged.emit()
|
self.currentPrintTimeChanged.emit()
|
||||||
|
|
||||||
self._material_amounts = material_amounts
|
self._material_amounts = material_amounts
|
||||||
self._calculateInformation()
|
self._calculateInformation(build_plate_number)
|
||||||
|
|
||||||
def _updateTotalPrintTimePerFeature(self, build_plate_number, print_time):
|
def _updateTotalPrintTimePerFeature(self, build_plate_number, print_time):
|
||||||
total_estimated_time = 0
|
total_estimated_time = 0
|
||||||
|
@ -192,16 +195,16 @@ class PrintInformation(QObject):
|
||||||
self._current_print_time[build_plate_number] = Duration(None, self)
|
self._current_print_time[build_plate_number] = Duration(None, self)
|
||||||
self._current_print_time[build_plate_number].setDuration(total_estimated_time)
|
self._current_print_time[build_plate_number].setDuration(total_estimated_time)
|
||||||
|
|
||||||
def _calculateInformation(self):
|
def _calculateInformation(self, build_plate_number):
|
||||||
if Application.getInstance().getGlobalContainerStack() is None:
|
if Application.getInstance().getGlobalContainerStack() is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# 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
|
||||||
radius = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2
|
radius = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2
|
||||||
self._material_lengths[self._active_build_plate] = []
|
self._material_lengths[build_plate_number] = []
|
||||||
self._material_weights[self._active_build_plate] = []
|
self._material_weights[build_plate_number] = []
|
||||||
self._material_costs[self._active_build_plate] = []
|
self._material_costs[build_plate_number] = []
|
||||||
self._material_names[self._active_build_plate] = []
|
self._material_names[build_plate_number] = []
|
||||||
|
|
||||||
material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings"))
|
material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings"))
|
||||||
|
|
||||||
|
@ -239,10 +242,10 @@ class PrintInformation(QObject):
|
||||||
length = round((amount / (math.pi * radius ** 2)) / 1000, 2)
|
length = round((amount / (math.pi * radius ** 2)) / 1000, 2)
|
||||||
else:
|
else:
|
||||||
length = 0
|
length = 0
|
||||||
self._material_weights[self._active_build_plate].append(weight)
|
self._material_weights[build_plate_number].append(weight)
|
||||||
self._material_lengths[self._active_build_plate].append(length)
|
self._material_lengths[build_plate_number].append(length)
|
||||||
self._material_costs[self._active_build_plate].append(cost)
|
self._material_costs[build_plate_number].append(cost)
|
||||||
self._material_names[self._active_build_plate].append(material_name)
|
self._material_names[build_plate_number].append(material_name)
|
||||||
|
|
||||||
self.materialLengthsChanged.emit()
|
self.materialLengthsChanged.emit()
|
||||||
self.materialWeightsChanged.emit()
|
self.materialWeightsChanged.emit()
|
||||||
|
@ -253,7 +256,8 @@ class PrintInformation(QObject):
|
||||||
if preference != "cura/material_settings":
|
if preference != "cura/material_settings":
|
||||||
return
|
return
|
||||||
|
|
||||||
self._calculateInformation()
|
for build_plate_number in range(Application.getInstance().getBuildPlateModel().maxBuildPlate + 1):
|
||||||
|
self._calculateInformation(build_plate_number)
|
||||||
|
|
||||||
def _onActiveMaterialChanged(self):
|
def _onActiveMaterialChanged(self):
|
||||||
if self._active_material_container:
|
if self._active_material_container:
|
||||||
|
@ -284,7 +288,8 @@ class PrintInformation(QObject):
|
||||||
self.currentPrintTimeChanged.emit()
|
self.currentPrintTimeChanged.emit()
|
||||||
|
|
||||||
def _onMaterialMetaDataChanged(self, *args, **kwargs):
|
def _onMaterialMetaDataChanged(self, *args, **kwargs):
|
||||||
self._calculateInformation()
|
for build_plate_number in range(Application.getInstance().getBuildPlateModel().maxBuildPlate + 1):
|
||||||
|
self._calculateInformation(build_plate_number)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setJobName(self, name):
|
def setJobName(self, name):
|
||||||
|
|
|
@ -433,7 +433,6 @@ class CuraEngineBackend(QObject, Backend):
|
||||||
self._postponed_scene_change_sources.append(source)
|
self._postponed_scene_change_sources.append(source)
|
||||||
return
|
return
|
||||||
|
|
||||||
Logger.log("d", " going to reslice: %s", build_plate_changed)
|
|
||||||
self.stopSlicing()
|
self.stopSlicing()
|
||||||
for build_plate_number in build_plate_changed:
|
for build_plate_number in build_plate_changed:
|
||||||
if build_plate_number not in self._build_plates_to_be_sliced:
|
if build_plate_number not in self._build_plates_to_be_sliced:
|
||||||
|
|
|
@ -59,8 +59,9 @@ class GCodeWriter(MeshWriter):
|
||||||
Logger.log("e", "GCode Writer does not support non-text mode.")
|
Logger.log("e", "GCode Writer does not support non-text mode.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
active_build_plate = Application.getInstance().getBuildPlateModel().activeBuildPlate
|
||||||
scene = Application.getInstance().getController().getScene()
|
scene = Application.getInstance().getController().getScene()
|
||||||
gcode_list = getattr(scene, "gcode_list")
|
gcode_list = getattr(scene, "gcode_list")[active_build_plate]
|
||||||
if gcode_list:
|
if gcode_list:
|
||||||
for gcode in gcode_list:
|
for gcode in gcode_list:
|
||||||
stream.write(gcode)
|
stream.write(gcode)
|
||||||
|
|
|
@ -162,7 +162,7 @@ class SliceInfo(Extension):
|
||||||
|
|
||||||
data["models"].append(model)
|
data["models"].append(model)
|
||||||
|
|
||||||
print_times = print_information._print_time_message_values
|
print_times = print_information.printTimes()
|
||||||
data["print_times"] = {"travel": int(print_times["travel"].getDisplayString(DurationFormat.Format.Seconds)),
|
data["print_times"] = {"travel": int(print_times["travel"].getDisplayString(DurationFormat.Format.Seconds)),
|
||||||
"support": int(print_times["support"].getDisplayString(DurationFormat.Format.Seconds)),
|
"support": int(print_times["support"].getDisplayString(DurationFormat.Format.Seconds)),
|
||||||
"infill": int(print_times["infill"].getDisplayString(DurationFormat.Format.Seconds)),
|
"infill": int(print_times["infill"].getDisplayString(DurationFormat.Format.Seconds)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue