From 192eaa0232f30f37cc978f1242ae37531196d58c Mon Sep 17 00:00:00 2001 From: Lev Kozlov Date: Sat, 16 Nov 2024 17:01:26 +0900 Subject: [PATCH 1/2] fix: update parsing for smooth slicing --- src/gcode.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gcode.py b/src/gcode.py index 90303c6..b336e77 100644 --- a/src/gcode.py +++ b/src/gcode.py @@ -282,14 +282,18 @@ def parseGCode(lines): line = line + ";" if len(line) == 0 or ";" not in line else line args, comment = line.split(";")[:2] args = args.split(" ") - if comment.lower() == "rotation": # we have either rotation or incline + if line.endswith("rotation"): # we have either rotation or incline + args, comment = line.split(";")[1:3] # we remove first colon + args = args.split(" ") printer.finishLayer() # if any(a.lower().startswith('u') for a in args): # rotation printer.rotations.append( Rotation(printer.rotations[-1].x_rot, parseRotation(args[1:])) ) printer.currPos.U = printer.rotations[-1].z_rot - elif comment.lower() == "incline": + elif line.endswith("incline"): + args, comment = line.split(";")[1:3] # we remove first colon + args = args.split(" ") printer.finishLayer() # if any(a.lower().startswith('v') for a in args): # incline printer.rotations.append( From 6b634fb162f330f26135f963d31d7c89a32263d5 Mon Sep 17 00:00:00 2001 From: Lev Kozlov Date: Sat, 16 Nov 2024 17:02:49 +0900 Subject: [PATCH 2/2] fix: ruff --- src/gcode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gcode.py b/src/gcode.py index b336e77..75cb45c 100644 --- a/src/gcode.py +++ b/src/gcode.py @@ -283,7 +283,7 @@ def parseGCode(lines): args, comment = line.split(";")[:2] args = args.split(" ") if line.endswith("rotation"): # we have either rotation or incline - args, comment = line.split(";")[1:3] # we remove first colon + args, comment = line.split(";")[1:3] # we remove first colon args = args.split(" ") printer.finishLayer() # if any(a.lower().startswith('u') for a in args): # rotation