diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-04-22 15:20:59 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-04-22 16:30:02 -0400 |
commit | 402110f65517ab357bd636907c8e8201059fda55 (patch) | |
tree | 1972c3c4d72dfd957824f04c67e2c8e05ff403c0 /klippy/extras/gcode_arcs.py | |
parent | ff28f33967f069a85dc86098ecfc9d14feb71c8b (diff) | |
download | kutter-402110f65517ab357bd636907c8e8201059fda55.tar.gz kutter-402110f65517ab357bd636907c8e8201059fda55.tar.xz kutter-402110f65517ab357bd636907c8e8201059fda55.zip |
gcode_arcs: Fix Z moves and E moves
Fix Z moves so that the movement is spaced out among the arc movements.
Fix extrude moves when in absolute extrude mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/gcode_arcs.py')
-rw-r--r-- | klippy/extras/gcode_arcs.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/klippy/extras/gcode_arcs.py b/klippy/extras/gcode_arcs.py index 219c76d8..64016133 100644 --- a/klippy/extras/gcode_arcs.py +++ b/klippy/extras/gcode_arcs.py @@ -22,12 +22,15 @@ class ArcSupport: self.gcode.register_command("G3", self.cmd_G2) def cmd_G2(self, params): - currentPos = self.gcode.get_status(None)['gcode_position'] + gcodestatus = self.gcode.get_status(None) + if not gcodestatus['absolute_coordinates']: + raise self.gcode.error("G2/G3 does not support relative move mode") + currentPos = gcodestatus['gcode_position'] # Parse parameters - asX = self.gcode.get_float("X", params) - asY = self.gcode.get_float("Y", params) - asZ = self.gcode.get_float("Z", params, None) + asX = self.gcode.get_float("X", params, currentPos[0]) + asY = self.gcode.get_float("Y", params, currentPos[1]) + asZ = self.gcode.get_float("Z", params, currentPos[2]) if self.gcode.get_float("R", params, None) is not None: raise self.gcode.error("G2/G3 does not support R moves") asI = self.gcode.get_float("I", params, 0.) @@ -39,20 +42,23 @@ class ArcSupport: clockwise = (params['#command'] == 'G2') # Build list of linear coordinates to move to - coords = self.planArc(currentPos, [asX, asY, 0., 0.], [asI, asJ], + coords = self.planArc(currentPos, [asX, asY, asZ], [asI, asJ], clockwise) if not coords: self.gcode.respond_info("G2/G3 could not translate '%s'" % (params['#original'],)) return + e_per_move = e_base = 0. + if asE is not None: + if gcodestatus['absolute_extrude']: + e_base = currentPos[3] + e_per_move = (asE - e_base) / len(coords) # Convert coords into G1 commands for coord in coords: - g1_params = {'X': coord[0], 'Y': coord[1]} - if asZ is not None: - g1_params['Z'] = asZ - if asE is not None: - g1_params['E'] = asE / len(coords) + g1_params = {'X': coord[0], 'Y': coord[1], 'Z': coord[2]} + if e_per_move: + g1_params['E'] = e_base + e_per_move if asF is not None: g1_params['F'] = asF self.gcode.cmd_G1(g1_params) |