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

    Clarification re: stop.g please...

    Scheduled Pinned Locked Moved Solved
    CNC
    3
    11
    411
    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
      last edited by Nightowl

      I've sort of asked this before, but have only just got around to completing this task and would like some clarity, please.

      stop.g: As I understand it, this is called when a (CNC or a printing) job finishes, or if you enter M98 P"stop.g" in the command line.

      Are there any other situations when stop.g is run, other than being called specifically from within another macro, please?

      Going on from this, if a job completes and the code within the stop.g file moves the spindle to a 'safe place' (rather than being moved to Work X0, Y0, Z+5, which happens at the moment, although I'm not sure why), will this affect the actual Work X0, Y0, Z0 coordinates, if I want to run the job again? I appreciate I would need to adjust Z0 if I change the cutter and/or the material thickness might be different, for example.

      I was thinking of using just this code within the stop.g file:

      G1 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)} F2400	; move the Z axis to a safe height		
      G0 X273.5 Y560							; move XY to a safe place
      

      Thank you

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

        @Nightowl M0 also calls stop.g
        I believe in 3.5 its going to be ran automatically rather than requiring to be called.
        If those coordinates are actual rather than workplace, put G53 in front, e.g. G53 G1 X10 Y10 and the actual coordinates will be used rather than the workplace.

        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 0
        • Nightowlundefined
          Nightowl @jay_s_uk
          last edited by

          @jay_s_uk

          The last few lines of the generated .gcode file are these:

          G2X229.500Y0.000I0.000J-1.000
          G0Z2.000
          M5
          G0Z5.000
          G0X0.000Y0.000
          

          Am I correct in thinking these are set by the post processor? If so, then I'll need to change the pp to reflect those settings above, or just replace those lines with M0 and use the stop.g code to move the spindle to the safe place.

          @jay_s_uk said in Clarification re: stop.g please...:

          If those coordinates are actual rather than workplace, put G53 in front,

          Oh, really? And I thought I was beginning to understand these things! So, using G53 to move the spindle to the save coordinates won't affect the work zero, so if I run the same job it won't start at some other random spot, but exactly where it started the last time?

          I just want to be sure.. šŸ¤• 😊

          Thanks

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

            @Nightowl yes, those last few lines look like they've been added by the post processer.

            And yes, G53 doesn't affect the workplace coordinates and only applies to that line it's on. So each line would need G53. Useful for when you have different workplace offsets for each job.

            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 @jay_s_uk
              last edited by Nightowl

              Thank you, @jay_s_uk , and just to be a PITA, which would be the best option...

              a) Amend the PP to:

              M5
              G53 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)} F2400	; move the Z axis to a safe height		
              G53 X273.5 Y560	F2400							; move XY to a safe place
              

              ...or...
              b) Amend the PP to:

              M5
              M98 P"stop.g"
              

              ...or...
              c) Amend the PP to:

              1| M5
              2| M0
              

              ... with options b) and c) requiring the stop.g file to be like this:

              ; stop.g
              M5
              G53 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)} F2400	; move the Z axis to a safe height		
              G53 X273.5 Y560	F2400							; move XY to a safe place
              

              ...or doesn't it really matter?

              (I'm not exactly sure where the Z height line came from, but I think DC42 commented on it before. I'll need to check...)

              Thanks

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

                @Nightowl I would say that it would be C but without M5, so purely M0.

                The z line looks like it will probably always move to max-5.
                But anyway, that all looks good

                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 @jay_s_uk
                  last edited by Nightowl

                  @jay_s_uk

                  Hmm, I must have missed something...

                  The last few lines of the gcode file look like this (where are the line numbers?):

                  ...
                  G1X69.400Y15.600
                  G1X69.597Y15.747
                  G1X69.828Y15.831
                  G0Z8.000
                  M0
                  

                  ...and this is the code in the stop.g file (there are line numbers here, though!):

                  ; stop.g
                  M5
                  G53 Z{max(move.axes[2].userPosition+5,move.axes[2].max-5)} F2400	; move the Z axis to a safe height		
                  G53 X273.5 Y560	F2400							; move XY to a safe place
                  

                  ...but, when I run the short test file, the spindle appears to move up, but not to the XY coordinates set in line 4.

                  EDIT: Actually, this was a dry run, so the spindle was off. I'll check if the M5 command works in the next couple of days).

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

                    @Nightowl the G53 command by itself doesn't cause motion, it just affects how coordinates in the rest of the line are interpreted. So you need to use G53 G1 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

                      Thank you, @dc42 . It had to be something straightforward šŸ‘

                      And thank you for being here on Christmas Eve!

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

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • Nightowlundefined
                          Nightowl
                          last edited by

                          Never mind, I’m sorted āœ…

                          1 Reply Last reply Reply Quote 0
                          • T3P3Tonyundefined T3P3Tony marked this topic as a question
                          • T3P3Tonyundefined T3P3Tony has marked this topic as solved
                          • First post
                            Last post
                          Unless otherwise noted, all forum content is licensed under CC-BY-SA