From 1ce5920d482d99e4d7430ddcde79b733ffae84a9 Mon Sep 17 00:00:00 2001 From: Mark Burton Date: Wed, 11 Apr 2018 08:28:13 +0100 Subject: [PATCH 1/3] Fix holes in spiralized objects that can occur at start of layer. The gcode reader assumed that each layer starts with a move to the initial position but for spiralized code that isn't true because the previous layer always ends up in the right location. So we now start each layer with a fake move to the end position of the previous layer. This won't actually cause a real move to occur but it ensures that the first line segment in the new layer has the correct initial point. --- plugins/GCodeReader/FlavorParser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 00cbbacacf..30701be059 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -368,6 +368,7 @@ class FlavorParser: layer_number = int(line[len(self._layer_keyword):]) self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0])) current_path.clear() + current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType]) # When using a raft, the raft layers are stored as layers < 0, it mimics the same behavior # as in ProcessSlicedLayersJob From f023f6ea13f55fae86fc10794360881d2043b9fc Mon Sep 17 00:00:00 2001 From: Mark Burton Date: Wed, 11 Apr 2018 08:54:17 +0100 Subject: [PATCH 2/3] Add comment. --- plugins/GCodeReader/FlavorParser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 30701be059..1052e35f11 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -368,6 +368,7 @@ class FlavorParser: layer_number = int(line[len(self._layer_keyword):]) self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0])) current_path.clear() + # start the new layer at the end position of the last layer current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType]) # When using a raft, the raft layers are stored as layers < 0, it mimics the same behavior From f328926be325117a74078c5e7ccab18d440fe060 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Mon, 23 Apr 2018 14:24:25 +0200 Subject: [PATCH 3/3] CURA-5275 Add the end point of the previous path also when there is a change in the tool. --- plugins/GCodeReader/FlavorParser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 92233ba14f..2679cc23a4 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -362,13 +362,13 @@ class FlavorParser: else: Logger.log("w", "Encountered a unknown type (%s) while parsing g-code.", type) - # When the layer change is reached, the polygon is computed so we have just one layer per layer per extruder + # When the layer change is reached, the polygon is computed so we have just one layer per extruder if self._is_layers_in_file and line[:len(self._layer_keyword)] == self._layer_keyword: try: layer_number = int(line[len(self._layer_keyword):]) self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0])) current_path.clear() - # start the new layer at the end position of the last layer + # Start the new layer at the end position of the last layer current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType]) # When using a raft, the raft layers are stored as layers < 0, it mimics the same behavior @@ -408,7 +408,11 @@ class FlavorParser: self._createPolygon(self._current_layer_thickness, current_path, self._extruder_offsets.get(self._extruder_number, [0, 0])) current_path.clear() + # When changing tool, store the end point of the previous path, then process the code and finally + # add another point with the new position of the head. + current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType]) current_position = self.processTCode(T, line, current_position, current_path) + current_path.append([current_position.x, current_position.y, current_position.z, current_position.f, current_position.e[self._extruder_number], LayerPolygon.MoveCombingType]) if line.startswith("M"): M = self._getInt(line, "M")