G-code reverse?



  • Would it be possible to run the gcode file backwards?

    For example, if running a CNC tool path, could you pause execution of the g-code, and and scroll backwards through g-code commands to replay movements, only in reverse?

    As described here: https://youtu.be/rpHYBz7ToII?t=194


  • administrators

    To find the starting coordinates of the previous move, you might have to scroll back an arbitrary number of lines of GCode in the file. That wouldn't be easy to do on Duet 2, but easier on Duet 3.



  • I think with edm (referenced in the link) you'd only need to slow or reverse the feedrate of the current g-code line instead of jumping back to previous lines in the g-code.

    So for example there would be a g-code to move downwards as a certain speed. The edm machine provides feedback to the duet board ether in the form of i2c or an analogue voltage to say your going too fast slow down, or you need to backup a bit then start going forward again within the current line of g-code.

    I put a bit of detail here


  • administrators

    If it's just the current line of GCode that needs to be reversed, or perhaps the last ~10 lines, then it would be possible. The firmware could keep track of the initial position and associated file offset for each of the previous 10 moves.



  • I would like to know if there is a way to control the feed rate from an external signal currently? even without reversing the sign.


  • administrators

    @nraynaud said in G-code reverse?:

    I would like to know if there is a way to control the feed rate from an external signal currently? even without reversing the sign.

    You can use the M220 command to change the speed factor, however it won't take effect until all moves already in the pipeline have been completed.



  • I would prefer a real time thing, probably something that could slow down the step clock if the filament extrusion is getting a bit behind.


Log in to reply