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

    First cut success - with questions!

    Scheduled Pinned Locked Moved
    Duet Web Control
    8
    66
    3.5k
    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.
    • Nightowlundefined
      Nightowl @engikeneer
      last edited by Nightowl

      Thanks, @engikeneer.

      So how do I do this with the spindle control? Will adding just the M3 command run the spindle at the same 'saved' speed? I'm not too clear on that!

      As it's a CNC machine I would prefer to raise the Z axis to 5mm below its maximum height on Pause, so how would I counteract that in the Resume?

      Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
      I'm still on my learning curve, so take everything I say with caution!

      RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

      engikeneerundefined dc42undefined 2 Replies Last reply Reply Quote 0
      • engikeneerundefined
        engikeneer @Nightowl
        last edited by

        @nightowl999 yes it will use the last set spindle speed if no S parameter is given (according to the docs at least...). I don't have a CNC to test it on though

        E3D TC with D3Mini and Toolboards.
        Home-built CoreXY, Duet Wifi, Chimera direct drive, 2x BMG, 300x300x300 build volume
        i3 clone with a bunch of mods

        Nightowlundefined 1 Reply Last reply Reply Quote 1
        • Nightowlundefined
          Nightowl @engikeneer
          last edited by Nightowl

          Thanks again, @engikeneer

          These are my proposed changes (except for the Z height, which I'll experiment with!), and I'll check if they work tomorrow.

          ; pause.g
          M5 ; stop the spindle
          G91 ; relative positioning
          G1 Z5 F360 ; lift Z by 5mm
          G90 ; absolute positioning
          G1 X0 Y0 F2400 ; go to X=0 Y=0

          ; resume.g
          G1 R1 X0 Y0 Z5 F2400 ; go to 5mm above position of the last print move
          G1 R1 X0 Y0 Z0 ; go back to the last print move
          M3 : turn the spindle on

          Thanks again 👍

          Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
          I'm still on my learning curve, so take everything I say with caution!

          RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

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

            @nightowl999 said in First cut success - with questions!:

            So how do I do this with the spindle control? Will adding just the M3 command run the spindle at the same 'saved' speed? I'm not too clear on that!

            I have to admit that I hadn't given any thought to restoring spindle speeds on resume. Spindle speeds are not saved in the restore point that is created when you execute a pause. However, I think you can achieve it like this. Caution: I have not tested this!

            In config.g add this

            global savedSpindleSpeed = 0
            

            In pause.g after the G1 Z move (see later) add this:

            if currentTool >= 0 & tools[state.currentTool].spindle >= 0
              set global.savedSpindleSpeed = tools[state.currentTool].spindleRpm  ; save the current spindle RPM
              M5   ; turn spindle off
            

            In resume.g (before the final move to the original position, if you have one):

            if currentTool >= 0 & tools[state.currentTool].spindle >= 0
              M3 S{global.savedSpindleSpeed}
              G4 S1  ; wait 1 second to allow the spindle to spin up
            

            As it's a CNC machine I would prefer to raise the Z axis to 5mm below its maximum height on Pause, so how would I counteract that in the Resume?

            Change these lines in pause.g:

            G91 ; relative positioning
            G1 Z5 F360 ; lift Z by 5mm
            G90 ; absolute positioning
            

            to:

            G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5}
            

            In resume.g you probably want to change this line:

            G1 R1 X0 Y0 Z5 F2400 ; go to 5mm above position of the last print move
            

            to:

            G1 R1 X0 Y0 F2400 ; go to above the paused XY position, keeping the current Z
            

            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

            OwenDundefined 1 Reply Last reply Reply Quote 2
            • OwenDundefined
              OwenD @dc42
              last edited by

              @Nightowl999
              There's a closing brace for the max() function missing on this line
              G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5}
              should be

              G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)}
              
              1 Reply Last reply Reply Quote 1
              • Nightowlundefined
                Nightowl
                last edited by Nightowl

                You guys are pretty damn good at this!

                Thank you @dc42, @OwenD and @engikeneer. I'll make the changes/updates tomorrow and let you know how I get on, as this might be of use to others!

                Thanks again 👍 👍 👏

                Edit: Am I correct in thinking the M5 and M3 commands are where you've put them (i.e. last and first, so the cutter in the spindle will cut the material rather than snap, as a safety precaution? Obviously it would be better not to hit anything at all, but just in case...!

                Also, is indenting of line of code important?

                It's late, but this is how I've interpreted your suggestions (without the description text but including the original, obsolete lines REM's out):

                ; pause.g
                ; M5
                ; G91
                ; G1 Z5 F360
                ; G90
                G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)}
                ; G1 X0 Y0 F2400
                if currentTool >= 0 & tools[state.currentTool].spindle >= 0
                set global.savedSpindleSpeed = tools[state.currentTool].spindleRpm
                M5

                ; resume.g
                ; G1 R1 X0 Y0 Z5 F2400
                if currentTool >= 0 & tools[state.currentTool].spindle >= 0
                M3 S{global.savedSpindleSpeed}
                G4 S1
                G1 R1 X0 Y0 F2400
                ; G1 R1 X0 Y0 Z0
                ; M3

                Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                I'm still on my learning curve, so take everything I say with caution!

                RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                o_lampeundefined Nightowlundefined 2 Replies Last reply Reply Quote 0
                • o_lampeundefined
                  o_lampe @Nightowl
                  last edited by o_lampe

                  @nightowl999 said in First cut success - with questions!:

                  G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)}

                  To me it looks like there is a little problem with this line...what if the userPosition is already higher than (max-5)? Would it try to move +5 anyways and hit the upper limit or stop automatically at max?
                  Either way, it would be best to test this scenario to see if it returns to the right hight after resume

                  //sidenote: for further reference it would be best to move this thread to either Meta commands or CNC section (IMHO)

                  Nightowlundefined dc42undefined JoergS5undefined 3 Replies Last reply Reply Quote 0
                  • Nightowlundefined
                    Nightowl @o_lampe
                    last edited by Nightowl

                    That's a bit worrying, @o_lampe, but I'm no code writer.

                    @o_lampe said in First cut success - with questions!:

                    To me it looks like there is a little problem with this line...what if the userPosition is already higher than (max-5)? Would it try to move +5 anyways and hit the upper limit or stop automatically at max?

                    My logical mind makes me think that line moves the Z axis up 5mm from it's current position, then moves to the maximum Z height less 5mm. I'm assuming the [2] refers to the "3rd" axis (e.g. X would be [0], Y [1] and Z [2])?

                    If that is the case, would only the following be needed to move the Z axis 5mm below the Z max:

                    G1 Z{max(move.axes[2].max-5)}

                    Could I enter that as a command line to test it?

                    Thank you

                    Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                    I'm still on my learning curve, so take everything I say with caution!

                    RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

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

                      @o_lampe said in First cut success - with questions!:

                      To me it looks like there is a little problem with this line...what if the userPosition is already higher than (max-5)? Would it try to move +5 anyways and hit the upper limit or stop automatically at max?

                      The move would be limited to max Z.

                      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

                      Nightowlundefined 1 Reply Last reply Reply Quote 0
                      • Nightowlundefined
                        Nightowl @dc42
                        last edited by

                        I guess you've answered my question, thank you @dc42!

                        👍

                        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                        I'm still on my learning curve, so take everything I say with caution!

                        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                        1 Reply Last reply Reply Quote 0
                        • Nightowlundefined
                          Nightowl
                          last edited by Nightowl

                          Implementing those changes has caused a different problem, I can't run any g-code files.

                          The console is reporting the following error:
                          M32 "0:/gcodes/Initial Test Cut.nc"
                          File 0:/gcodes/Initial Test Cut.nc selected for printing
                          Cancelled printing file 0:/gcodes/Initial Test Cut.nc, print time was 0h 0m
                          Error: G0/G1: target position outside machine limits

                          I've REM'd out the global variable in config.g, but that didn't make any difference. Does it matter where this is located within the config.g file? I've put it after General Preferences.

                          I can't get far enough to test the pause.g or resume.g files.

                          Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                          I'm still on my learning curve, so take everything I say with caution!

                          RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

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

                            @nightowl999 which firmware version are you using? If you are using recent firmware that supports the 'global' command then I think you must have made another change at the same time. The position of that command in config.g is not critical, but I suggest near the end.

                            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

                            Nightowlundefined 2 Replies Last reply Reply Quote 0
                            • Nightowlundefined
                              Nightowl
                              last edited by

                              This has become rather perplexing...

                              Yesterday I could run a couple of test cuts without any problem. In fact, I was really pleased!

                              After implementing the changes above (although I didn't check the machine before I made those changes today!) the files won't run, reporting the error:

                              M32 "0:/gcodes/Initial Test Cut.nc"
                              File 0:/gcodes/Initial Test Cut.nc selected for printing
                              Cancelled printing file 0:/gcodes/Initial Test Cut.nc, print time was 0h 0m
                              Error: G0/G1: target position outside machine limits

                              So I reverted to the original pause.g and resume.g files and REM'd out the global command, but I still get the same issue.

                              I have had the outside machine limits error before, when trying to sort the axes and limit switches out, but that got resolved.

                              Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                              I'm still on my learning curve, so take everything I say with caution!

                              RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                              1 Reply Last reply Reply Quote 0
                              • Nightowlundefined
                                Nightowl @dc42
                                last edited by Nightowl

                                @dc42

                                Board: Duet 3 MB6HC (MB6HC)
                                Firmware: RepRapFirmware for Duet 3 MB6HC 3.3 (2021-06-15)

                                Which is a bit weird, because I keep copies of the version upgrades (in case I need to go back) and the version I have in storage is 3.4

                                Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                I'm still on my learning curve, so take everything I say with caution!

                                RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                1 Reply Last reply Reply Quote 0
                                • Nightowlundefined
                                  Nightowl @dc42
                                  last edited by

                                  @dc42

                                  Just updated the firmware, but there's no difference.

                                  I guess I'll start from scratch and go through the RRF config tool again.

                                  Ho hum 😢 😢

                                  Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                  I'm still on my learning curve, so take everything I say with caution!

                                  RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                  fcwiltundefined 1 Reply Last reply Reply Quote 0
                                  • jay_s_ukundefined
                                    jay_s_uk
                                    last edited by

                                    @nightowl999 why? its obvious whats going on. you're trying to run a job outside the axis limits. redoing the config won't change that

                                    Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                    1 Reply Last reply Reply Quote 1
                                    • fcwiltundefined
                                      fcwilt @Nightowl
                                      last edited by

                                      @nightowl999 said in First cut success - with questions!:

                                      I guess I'll start from scratch and go through the RRF config tool again.

                                      IMHO the RRF config tool is a barrier to learning the g-code that controls your machine.

                                      The issue of trying to move past the axis limits is simple. However you generated the code it was using axis limits that did not match your machine.

                                      How do you generate code for a CNC machine?

                                      Thanks.

                                      Frederick

                                      Printers: a E3D MS/TC setup and a RatRig Hybrid. Using Duet 3 hardware running 3.4.6

                                      Nightowlundefined 2 Replies Last reply Reply Quote 1
                                      • Nightowlundefined
                                        Nightowl @fcwilt
                                        last edited by

                                        @jay_s_uk

                                        @jay_s_uk said in First cut success - with questions!:

                                        @nightowl999 why? its obvious whats going on. you're trying to run a job outside the axis limits. redoing the config won't change that

                                        I guess I must be, but redoing the config (or at least looking at my original config to compare with the existing one) was the only place I felt I could reliably start from, but there is little difference between the two files.

                                        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                        I'm still on my learning curve, so take everything I say with caution!

                                        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                                        jay_s_ukundefined 1 Reply Last reply Reply Quote 0
                                        • jay_s_ukundefined
                                          jay_s_uk @Nightowl
                                          last edited by

                                          @nightowl999 exactly, little difference so is a pointless task.
                                          What are your M208 limits?
                                          Are you using workplace offsets?
                                          How big is the part?
                                          What coordinates is the part at in the CAM software?
                                          Are you working with 0 as the top of the stock or the top of the spoil board?

                                          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                                          Nightowlundefined 1 Reply Last reply Reply Quote 1
                                          • Nightowlundefined
                                            Nightowl @fcwilt
                                            last edited by

                                            @fcwilt

                                            @fcwilt said in First cut success - with questions!:

                                            The issue of trying to move past the axis limits is simple. However you generated the code it was using axis limits that did not match your machine.
                                            How do you generate code for a CNC machine?

                                            Yesterday I was using Vectric Cut2D Trial version to cut their 'Avalon' sample file and ran it successfully, but this was before I made any of the changes shown above.

                                            I made the file changes today and then used Vectric Cut2D Desktop version (I've just bought the license) to run a small test file, and get the error.

                                            I've homed the machine after turning it on, moved the gantry to - and set - the work zero and loaded the file, then I got the error. IO am able to jog the machine in any of the 6 directions away from the work zero, and the machine goes back to that spot when I click Home All, but again the file won't run.

                                            What have I missed?

                                            Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                                            I'm still on my learning curve, so take everything I say with caution!

                                            RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

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