diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 96a477031e..6a947866d3 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -19,6 +19,7 @@ import numpy catalog = i18nCatalog("cura") + class ProcessSlicedLayersJob(Job): def __init__(self, layers): super().__init__() @@ -48,7 +49,6 @@ class ProcessSlicedLayersJob(Job): Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged) - object_id_map = {} new_node = SceneNode() ## Remove old layer data (if any) @@ -88,8 +88,8 @@ class ProcessSlicedLayersJob(Job): for p in range(layer.repeatedMessageCount("polygons")): polygon = layer.getRepeatedMessage("polygons", p) - points = numpy.fromstring(polygon.points, dtype="i8") # Convert bytearray to numpy array - points = points.reshape((-1,2)) # We get a linear list of pairs that make up the points, so make numpy interpret them correctly. + points = numpy.fromstring(polygon.points, dtype="i8") # Convert bytearray to numpy array + points = points.reshape((-1,2)) # We get a linear list of pairs that make up the points, so make numpy interpret them correctly. # Create a new 3D-array, copy the 2D points over and insert the right height. # This uses manual array creation + copy rather than numpy.insert since this is @@ -124,13 +124,13 @@ class ProcessSlicedLayersJob(Job): self._progress.hide() return - #Add layerdata decorator to scene node to indicate that the node has layerdata + # Add LayerDataDecorator to scene node to indicate that the node has layer data decorator = LayerDataDecorator.LayerDataDecorator() decorator.setLayerData(layer_data) new_node.addDecorator(decorator) new_node.setMeshData(mesh) - new_node.setParent(self._scene.getRoot()) #Note: After this we can no longer abort! + new_node.setParent(self._scene.getRoot()) # Note: After this we can no longer abort! if not settings.getSettingValue("machine_center_is_zero"): new_node.setPosition(Vector(-settings.getSettingValue("machine_width") / 2, 0.0, settings.getSettingValue("machine_depth") / 2)) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index ccd5d32eb3..f51cff5d93 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -14,9 +14,10 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from cura.OneAtATimeIterator import OneAtATimeIterator + ## Formatter class that handles token expansion in start/end gcod class GcodeStartEndFormatter(Formatter): - def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class] + def get_value(self, key, args, kwargs): # [CodeStyle: get_value is an overridden function from the Formatter class] if isinstance(key, str): try: return kwargs[key] @@ -27,7 +28,8 @@ class GcodeStartEndFormatter(Formatter): Logger.log("w", "Incorrectly formatted placeholder '%s' in start/end gcode", key) return "{" + str(key) + "}" -## Job class that handles sending the current scene data to CuraEngine + +## Job that handles sending the current scene data to CuraEngine class StartSliceJob(Job): def __init__(self, profile, socket): super().__init__() @@ -49,6 +51,7 @@ class StartSliceJob(Job): for node in OneAtATimeIterator(self._scene.getRoot()): temp_list = [] + ## Node can't be printed, so don't bother sending it. if getattr(node, "_outside_buildarea", False): continue @@ -118,7 +121,7 @@ class StartSliceJob(Job): return str(value).encode("utf-8") def _sendSettings(self, profile): - msg = self._socket.createMessage("cura.proto.SettingList"); + msg = self._socket.createMessage("cura.proto.SettingList") settings = profile.getAllSettingValues(include_machine = True) start_gcode = settings["machine_start_gcode"] settings["material_bed_temp_prepend"] = "{material_bed_temperature}" not in start_gcode