From 347dfa58eab8286ad2e71efe9e11260ca35b61c6 Mon Sep 17 00:00:00 2001 From: maze Date: Wed, 14 Dec 2022 18:06:11 +0100 Subject: [PATCH] gcode_arcs: Allow either one of I, J, K to be default-zero on G2/G3 (#5939) Signed-off-by: Wijnand Modderman-Lenstra --- klippy/extras/gcode_arcs.py | 2 +- test/klippy/gcode_arcs.test | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/klippy/extras/gcode_arcs.py b/klippy/extras/gcode_arcs.py index 7707cd66..76c165dd 100644 --- a/klippy/extras/gcode_arcs.py +++ b/klippy/extras/gcode_arcs.py @@ -84,7 +84,7 @@ class ArcSupport: asPlanar = [ gcmd.get_float(a, 0.) for i,a in enumerate('JK') ] axes = (Y_AXIS, Z_AXIS, X_AXIS) - if not asPlanar[0] or not asPlanar[1]: + if not (asPlanar[0] or asPlanar[1]): raise gcmd.error("G2/G3 requires IJ, IK or JK parameters") asE = gcmd.get_float("E", None) diff --git a/test/klippy/gcode_arcs.test b/test/klippy/gcode_arcs.test index 6f9a7e3a..658ccad0 100644 --- a/test/klippy/gcode_arcs.test +++ b/test/klippy/gcode_arcs.test @@ -11,6 +11,12 @@ G2 X125 Y32 Z20 E1 I10.5 J10.5 # XY+Z arc move G2 X20 Y20 Z10 E1 I10.5 J10.5 +# allowable commands +G2 X20 Y20 I0 J10 +G2 X20 Y20 J10 +G2 X20 Y20 I10 J0 +G2 X20 Y20 I10 + # Home and move in XZ arc G28 G90 @@ -21,6 +27,12 @@ G2 X125 Y20 Z32 E1 I10.5 K10.5 # XZ+Y arc move G2 X20 Y10 Z20 E1 I10.5 K10.5 +# allowable commands +G2 X20 Y20 I0 K10 +G2 X20 Y20 K10 +G2 X20 Y20 I10 K0 +G2 X20 Y20 I10 + # Home and move in YZ arc G28 G90 @@ -30,3 +42,9 @@ G2 X20 Y125 Z32 E1 J10.5 K10.5 # YZ+X arc move G2 X10 Y20 Z20 E1 J10.5 K10.5 + +# allowable commands +G2 X20 Y20 J0 K10 +G2 X20 Y20 K10 +G2 X20 Y20 J10 K0 +G2 X20 Y20 J10