From 812bf2f4aabef46d100e02d76687e4175bf5f32b Mon Sep 17 00:00:00 2001 From: Ole Kroeger Date: Wed, 2 Mar 2022 14:25:05 +0100 Subject: [PATCH 1/3] use current filament diameter --- plugins/GCodeReader/FlavorParser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 8d35bd3345..428d9739b0 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -53,7 +53,7 @@ class FlavorParser: def _clearValues(self) -> None: self._extruder_number = 0 - self._extrusion_length_offset = [0] # type: List[float] + self._extrusion_length_offset = [0,0,0,0] # type: List[float] self._layer_type = LayerPolygon.Inset0Type self._layer_number = 0 self._previous_z = 0 # type: float @@ -283,8 +283,9 @@ class FlavorParser: return func(position, params, path) return position - def processTCode(self, T: int, line: str, position: Position, path: List[List[Union[float, int]]]) -> Position: + def processTCode(self, global_stack, T: int, line: str, position: Position, path: List[List[Union[float, int]]]) -> Position: self._extruder_number = T + self._filament_diameter = global_stack.extruderList[self._extruder_number].getProperty("material_diameter", "value") if self._extruder_number + 1 > len(position.e): self._extrusion_length_offset.extend([0] * (self._extruder_number - len(position.e) + 1)) position.e.extend([0] * (self._extruder_number - len(position.e) + 1)) @@ -354,7 +355,7 @@ class FlavorParser: Logger.log("d", "Parsing g-code...") - current_position = Position(0, 0, 0, 0, [0]) + current_position = Position(0, 0, 0, 0, [0,0,0,0]) current_path = [] #type: List[List[float]] min_layer_number = 0 negative_layers = 0 @@ -444,7 +445,7 @@ class FlavorParser: # 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_position = self.processTCode(global_stack, 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"): From 0ff94c6150ac6bcfb1c03677fd438e51f27887dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=B6ger?= Date: Thu, 3 Mar 2022 11:03:28 +0100 Subject: [PATCH 2/3] Update plugins/GCodeReader/FlavorParser.py Co-authored-by: Jaime van Kessel --- plugins/GCodeReader/FlavorParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 428d9739b0..147718449a 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -53,7 +53,7 @@ class FlavorParser: def _clearValues(self) -> None: self._extruder_number = 0 - self._extrusion_length_offset = [0,0,0,0] # type: List[float] + self._extrusion_length_offset = [0] * 8 # type: List[float] self._layer_type = LayerPolygon.Inset0Type self._layer_number = 0 self._previous_z = 0 # type: float From 893da1ed389d66350419aba32cd02e968211409f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=B6ger?= Date: Thu, 3 Mar 2022 11:03:33 +0100 Subject: [PATCH 3/3] Update plugins/GCodeReader/FlavorParser.py Co-authored-by: Jaime van Kessel --- plugins/GCodeReader/FlavorParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index 147718449a..ac24ce3184 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -355,7 +355,7 @@ class FlavorParser: Logger.log("d", "Parsing g-code...") - current_position = Position(0, 0, 0, 0, [0,0,0,0]) + current_position = Position(0, 0, 0, 0, [0] * 8) current_path = [] #type: List[List[float]] min_layer_number = 0 negative_layers = 0