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

    Tool-change macros with parameters

    Scheduled Pinned Locked Moved
    Firmware wishlist
    4
    8
    182
    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.
    • reroundefined
      rero
      last edited by

      Good evening,

      when using duet-boards on CNC-Mills (or other devices != 3D Printer) it is required to create/write a set of tool-change macros for each tool(-position):

      tfree1.g, tpre1.g, tpost1.g, tfree2.g, tpre2.g, tpost2.g, and so on and so forth ...

      For my current project I created these files, but they contain just a single line to call a generic, parametrized version:

      ; tfree1.g calls my tool-change macro
      M98 P"tfree.g" X1
      

      It would be nice if such a mechanism would be supported out of the box inside RRF.
      And I could get rid of 57 macros (19 tools) in my sys-folder 😉

      jay_s_ukundefined dwuk3dundefined 2 Replies Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @rero
        last edited by

        @rero it would be nice to be able to have tfree.g etc work without the number and just call one set of tool change files, especially if it's a single head machine.
        I'm lazy and use a macro to create multiple of the same file.
        E.g.

        while iterations < 4
                set var.filename = "tpost"^{iterations}^".g"
                echo >{var.filename} "; autogenerated tpost"^iterations^".g file"
                echo >>{var.filename} "M98 P""0:/sys/AFC/tpost.g"" A"^{iterations}
        

        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 0
        • dwuk3dundefined
          dwuk3d @rero
          last edited by

          @rero From looking at the RRF code it looks like it will first try tfree with a number on it - but will then if this doesn't work it will then try a file without a number as a fallback.

          https://github.com/Duet3D/RepRapFirmware/commit/7cea891dcdc276e12edda2c991ce8fb415cfc03a

          0 chrishamm committed to Duet3D/RepRapFirmware
          Added support for tool macro fallbacks
          
          tpre.g/tpost.g/tfree.g is executed if the specific t...N.g macro is not found
          jay_s_ukundefined 1 Reply Last reply Reply Quote 0
          • jay_s_ukundefined
            jay_s_uk @dwuk3d
            last edited by

            @dwuk oh really? I'll try that and see if it works

            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

            reroundefined 1 Reply Last reply Reply Quote 0
            • reroundefined
              rero @jay_s_uk
              last edited by

              @dwuk great find!

              Just tried it on my test-setup and it works as intended.
              Only complaint: no information about the upcoming tool-number in the tpre.g macro.
              But for my concrete needs I should be able to move existing tpre-code to tpost.

              -> Maybe someone can add this information to https://docs.duet3d.com/User_manual/Tuning/Tool_changing ?

              Another idea: having another tXXX-macro which is executed in case a tool has been already selected previously (e.g. to probe a current milling-tool again).

              jay_s_ukundefined T3P3Tonyundefined 2 Replies Last reply Reply Quote 1
              • jay_s_ukundefined
                jay_s_uk @rero
                last edited by

                @rero the next tool should be available in the object model under state.nextTool

                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

                reroundefined 1 Reply Last reply Reply Quote 0
                • reroundefined
                  rero @jay_s_uk
                  last edited by

                  @jay_s_uk thanks for pointing out!

                  "Can't see the forest for the trees" ... 🕶

                  1 Reply Last reply Reply Quote 1
                  • T3P3Tonyundefined
                    T3P3Tony administrators @rero
                    last edited by

                    @rero said in Tool-change macros with parameters:

                    -> Maybe someone can add this information to https://docs.duet3d.com/User_manual/Tuning/Tool_changing ?

                    paging @droftarts

                    www.duet3d.com

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