Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Macro for Pause print, do XYZ, resume print - Retraction fails

    Scheduled Pinned Locked Moved
    Tuning and tweaking
    4
    6
    404
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • punamenonundefined
      punamenon
      last edited by

      During Layer changes I want to move the print head to the far extreme of X movement. To this end, I am using a G60 S1, to save the last print location, then a G1 R1 to recall that location and move the print head back to the location. This is functioning perfectly. I'm having a problem with retraction. Specifically the re-priming of the nozzle to resume printing. As you can see in the code of my macro, the priming command is issued AFTER the "G1 R1" This should mean that the printer moves to the last print location before priming the nozzle. The machine is instead priming the nozzle before the print head has finished moving back to the saved print location. Is there a way to ensure that the Duet board will pause on a line of the G-code and not do anything else until the previous command has completed it's action?

      G60 S1 ; store current locating information
      G91 ; relative coordinates
      G0 F2000 ; feedrate of 2000mm per min
      G0 E-4 ; retract 4mm of filament
      G90 ; absolute coordinates
      G0 F5000 ; feedrate of 500 mm per min
      G0 X267.5 ; move off the edge of the bed for print wiping
      G1 R1 ; recall location information from the G60
      G91 ; relative coordinates
      G0 F2000 ; feedrate of 2000mm per min
      G0 E4 ; prime nozzle for restarting print
      G90 ; absolute coordinates

      Phaedruxundefined 1 Reply Last reply Reply Quote 0
      • botundefined
        bot
        last edited by bot

        This is a custom macro, right? Not a system macro like resume.g?

        I think if you insert M400 before the E prime, the printer will wait until it is in position.

        I think the reason it isn't waiting already is because the E axis is not involved in the coordinated move back to R1.

        Perhaps, simply changing the G0 E move to be a G1 move might correct that, but I doubt it so M400 should work.

        M400 waits until all previous commands are cleared before executing the rest of the file.

        Edit: also, you should probably not be switching to G91 relative coordinates, as this doesn't switch the extruder, only movement axes. Instead you should use M83 and M82.

        *not actually a robot

        punamenonundefined 2 Replies Last reply Reply Quote 1
        • punamenonundefined
          punamenon @bot
          last edited by

          @bot Actually, it's a bit of G-code that I have implemented into my slicer (simplify 3D) By inserting it at every layer change.

          I will try the changes you have suggested. These appear to be very good information. Thank you.

          1 Reply Last reply Reply Quote 1
          • Phaedruxundefined
            Phaedrux Moderator @punamenon
            last edited by Phaedrux

            @punamenon said in Macro for Pause print, do XYZ, resume print - Retraction fails:

            Is there a way to ensure that the Duet board will pause on a line of the G-code and not do anything else until the previous command has completed it's action?

            M400
            https://duet3d.dozuki.com/Wiki/Gcode#Section_M400_Wait_for_current_moves_to_finish

            But I'm not sure if that's appropriate in this case, or if it's a bug.

            What firmware version?

            Weird. I swear there were no other replied when I went to reply.

            Z-Bot CoreXY Build | Thingiverse Profile

            1 Reply Last reply Reply Quote 1
            • punamenonundefined
              punamenon @bot
              last edited by

              @bot That worked thanks. Turns out that it was retracting for each layer change already so I didn't need the M83, but that was a good tip. Thanks. Here is what I ended up with:

              G60 S1 ; store current locating information
              G1 X267.5 F6000 ; move off the edge of the bed for print wiping
              G1 R1 ; recall location information from the G60
              M400 ; wait until movement is finised before proceeding

              Thanks Phaedrux 😉 M400 seems to be working, but I didn't do rigorous before and after testing so I can't say if it is needed or not. At any rate the above script achieves the desired outcome.

              dc42undefined 1 Reply Last reply Reply Quote 1
              • dc42undefined
                dc42 administrators @punamenon
                last edited by

                @punamenon, which Duet and firmware version are you using? The M400 command should not be needed.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA