Skip to content

Commit eb80797

Browse files
committed
hotfix: updated parsing
1 parent 026e618 commit eb80797

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/gcode.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,34 @@ def parseGCode(lines):
282282
line = line + ";" if len(line) == 0 or ";" not in line else line
283283
args, comment = line.split(";")[:2]
284284
args = args.split(" ")
285-
if line.endswith("rotation"): # we have either rotation or incline
285+
if line.endswith("rotation-hack"): # we pass U in the comment section
286286
args, comment = line.split(";")[1:3] # we remove first colon
287287
args = args.split(" ")
288288
printer.finishLayer()
289-
# if any(a.lower().startswith('u') for a in args): # rotation
290289
printer.rotations.append(
291290
Rotation(printer.rotations[-1].x_rot, parseRotation(args[1:]))
292291
)
293292
printer.currPos.U = printer.rotations[-1].z_rot
294-
elif line.endswith("incline"):
293+
elif line.endswith("rotation"): # we have either rotation or incline
294+
printer.finishLayer()
295+
printer.rotations.append(
296+
Rotation(printer.rotations[-1].x_rot, parseRotation(args[1:]))
297+
)
298+
printer.currPos.U = printer.rotations[-1].z_rot
299+
elif line.endswith("incline-hack"):
295300
args, comment = line.split(";")[1:3] # we remove first colon
296301
args = args.split(" ")
297302
printer.finishLayer()
298-
# if any(a.lower().startswith('v') for a in args): # incline
303+
printer.rotations.append(
304+
Rotation(parseRotation(args[1:]), printer.rotations[-1].z_rot)
305+
)
306+
307+
printer.cone_axis = rotation_matrix(
308+
[1, 0, 0], np.radians(printer.rotations[-1].x_rot)
309+
).dot([0, 0, 1])
310+
printer.currPos.V = printer.rotations[-1].x_rot
311+
elif line.endswith("incline"):
312+
printer.finishLayer()
299313
printer.rotations.append(
300314
Rotation(parseRotation(args[1:]), printer.rotations[-1].z_rot)
301315
)

0 commit comments

Comments
 (0)