Merge remote-tracking branch 'origin/5.9'

This commit is contained in:
Erwan MATHIEU 2024-10-22 10:43:28 +02:00
commit 3b374368c4
102 changed files with 3303 additions and 638 deletions

View file

@ -132,6 +132,7 @@ class ThreeMFReader(MeshReader):
vertices = numpy.resize(data, (int(data.size / 3), 3))
mesh_builder.setVertices(vertices)
mesh_builder.calculateNormals(fast=True)
mesh_builder.setMeshId(node_id)
if file_name:
# The filename is used to give the user the option to reload the file if it is changed on disk
# It is only set for the root node of the 3mf file

View file

@ -1354,7 +1354,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
return
machine_manager.setQualityChangesGroup(quality_changes_group, no_dialog = True)
else:
self._quality_type_to_apply = self._quality_type_to_apply.lower() if self._quality_type_to_apply else None
quality_group_dict = container_tree.getCurrentQualityGroups()
if self._quality_type_to_apply in quality_group_dict:
quality_group = quality_group_dict[self._quality_type_to_apply]

View file

@ -68,6 +68,9 @@ class CuraEngineBackend(QObject, Backend):
"""
super().__init__()
self._init_done = False
self._immediate_slice_after_init = False
# Find out where the engine is located, and how it is called.
# This depends on how Cura is packaged and which OS we are running on.
executable_name = "CuraEngine"
@ -268,6 +271,10 @@ class CuraEngineBackend(QObject, Backend):
self._machine_error_checker = application.getMachineErrorChecker()
self._machine_error_checker.errorCheckFinished.connect(self._onStackErrorCheckFinished)
self._init_done = True
if self._immediate_slice_after_init:
self.slice()
def close(self) -> None:
"""Terminate the engine process.
@ -342,6 +349,11 @@ class CuraEngineBackend(QObject, Backend):
def slice(self) -> None:
"""Perform a slice of the scene."""
if not self._init_done:
self._immediate_slice_after_init = True
return
self._immediate_slice_after_init = False
self._createSnapshot()
self.startPlugins()

View file

@ -112,15 +112,13 @@ class MakerbotWriter(MeshWriter):
match file_format:
case "application/x-makerbot-sketch":
filename, filedata = "print.gcode", gcode_text_io.getvalue()
self._PNG_FORMATS = self._PNG_FORMAT
case "application/x-makerbot":
filename, filedata = "print.jsontoolpath", du.gcode_2_miracle_jtp(gcode_text_io.getvalue())
self._PNG_FORMATS = self._PNG_FORMAT + self._PNG_FORMAT_METHOD
case _:
raise Exception("Unsupported Mime type")
png_files = []
for png_format in self._PNG_FORMATS:
for png_format in (self._PNG_FORMAT + self._PNG_FORMAT_METHOD):
width, height, prefix = png_format["width"], png_format["height"], png_format["prefix"]
thumbnail_buffer = self._createThumbnail(width, height)
if thumbnail_buffer is None:

View file

@ -256,9 +256,19 @@ class SimulationView(CuraView):
polylines = self.getLayerData()
if polylines is not None:
for polyline in polylines.polygons:
for line_duration in list((polyline.lineLengths / polyline.lineFeedrates)[0]):
for line_index in range(len(polyline.lineLengths)):
line_length = polyline.lineLengths[line_index]
line_feedrate = polyline.lineFeedrates[line_index][0]
if line_feedrate > 0.0:
line_duration = line_length / line_feedrate
else:
# Something is wrong with this line, set an arbitrary non-null duration
line_duration = 0.1
total_duration += line_duration / SimulationView.SIMULATION_FACTOR
self._cumulative_line_duration.append(total_duration)
# for tool change we add an extra tool path
self._cumulative_line_duration.append(total_duration)
# set current cached layer
@ -583,7 +593,7 @@ class SimulationView(CuraView):
self._max_thickness = sys.float_info.min
self._min_flow_rate = sys.float_info.max
self._max_flow_rate = sys.float_info.min
self._cumulative_line_duration = {}
self._cumulative_line_duration = []
# The colour scheme is only influenced by the visible lines, so filter the lines by if they should be visible.
visible_line_types = []